Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete a view and recreate it

Tags:

android

Is there a way to remove a view that was set with

setContentView(R.layout.set_map_center);
mapView = (MapView) findViewById(R.id.mapview);

If I call this view again then I get an error saying:

java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity

like image 808
ProNeticas Avatar asked Nov 14 '22 02:11

ProNeticas


1 Answers

((ViewGroup)mapView.getParent()).removeView(mapView);
like image 120
Mathias Conradt Avatar answered Dec 18 '22 19:12

Mathias Conradt