android - Delete a view and recreate it -


is there way remove view set with

setcontentview(r.layout.set_map_center); mapview = (mapview) findviewbyid(r.id.mapview); 

if call view again error saying:

java.lang.illegalstateexception: allowed have single mapview in mapactivity

try this.. first inflate view trying set in setcontentview() following code;

layout = new linearlayout(context);     layout.setvisibility(visible);     v = view.inflate(getcontext(), r.layout.set_map_center, layout); framelayout.layoutparams params = new framelayout.layoutparams(             layoutparams.wrap_content, layoutparams.wrap_content); params.gravity = gravity.no_gravity;     addview(layout, params);     v.setvisibility(visible); layout.setvisibility(visible); 

whenever want delete view can layout.setvisibility(gone) if not able access gone view.gone


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -