Android: two activities with two maps; the second one doesn't load properly -
i try explain better: app has tab bar (a tabhost) , 2 of tabs 2 activities map each. when click on first tab map , can use want. when click on second 1 same map, same markers , same path drawn on , can't move map. don't want act that. every activity has use different maps.
i using v2 maps , 2 activities extend android.support.v4.app.fragmentactivity.
note if click on second activity first, can use map want , problem repeats on first activity.
i not reusing nothing! has different names, ids, ecc...
please help!
p.s. here code use initialize map (in 1 activity):
private void setupmapifneeded() { // null check confirm have not instantiated map. if (mmap == null) { logger.log("mmap = null"); // try obtain map supportmapfragment. mmap = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.mapfollow)) .getmap(); mmap.getuisettings().setcompassenabled(false); mapcontainer = getsupportfragmentmanager().findfragmentbyid(r.id.mapfollow).getview(); // check if successful in obtaining map. if (mmap == null) { //todo: dialog error map. } } } every time switch between 2 activities "mmap = null" log...
the problem seems trying put 2 surfaceviews (map drawn on this). activitygroup (tabactivity extends it) long deprecated , better of switching correct use of fragments. make single fragmentactivity, switches between 2 mapfragments.
Comments
Post a Comment