android - Multiple MapActivitys in the stack -
i understand topic has been covered few times, , proposed solution having 'multiple' mapactivity classes run 1 in different processes. don't want this, i've got 3.
i've instead refactored 1 mapactivity subclass operate in 3 different modes.
package com.rossgreenhalf.maptest.activity; import android.os.bundle; import com.google.android.maps.mapactivity; public class mymapactivity extends mapactivity { @override protected void oncreate(bundle icicle) { super.oncreate(icicle); /* inflate xml view, set zoom etc */ } @override protected void onresume() { super.onresume(); int mode = getintent().getextras().getint("map_mode"); switch(mode){ case 1: /* markers show */ break; case 2: /* 1 marker */ break; case 3: /* showing location */ break; } } @override protected boolean isroutedisplayed() { return false; } }
i'm allowing multiple instances of mapactivity reside within task stack, it's launch mode still set 'standard'. approach seems work ok, , i'm not getting connection pool shutdown message seem get, i'm little confused whether multiple mapactivity instances exist or whether android reusing 1 automatically?
i getting error, don't know how serious is:
01-25 10:14:54.433: error/activitythread(5620): activity com.rossgreenhalf.maptest.activity.mymapactivity has leaked intentreceiver com.google.android.maps.networkconnectivitylistener$connectivitybroadcastreceiver@44981cf0 registered here. missing call unregisterreceiver()? 01-25 10:14:54.433: error/activitythread(5620): android.app.intentreceiverleaked: activity com.rossgreenhalf.maptest.activity.mymapactivity has leaked intentreceiver com.google.android.maps.networkconnectivitylistener$connectivitybroadcastreceiver@44981cf0 registered here. missing call unregisterreceiver()? 01-25 10:14:54.433: error/activitythread(5620): @ android.app.activitythread$packageinfo$receiverdispatcher.(activitythread.java:968) 01-25 10:14:54.433: error/activitythread(5620): @ android.app.activitythread$packageinfo.getreceiverdispatcher(activitythread.java:753) 01-25 10:14:54.433: error/activitythread(5620): @ android.app.contextimpl.registerreceiverinternal(contextimpl.java:799) 01-25 10:14:54.433: error/activitythread(5620): @ android.app.contextimpl.registerreceiver(contextimpl.java:786) 01-25 10:14:54.433: error/activitythread(5620): @ android.app.contextimpl.registerreceiver(contextimpl.java:780) 01-25 10:14:54.433: error/activitythread(5620): @ android.content.contextwrapper.registerreceiver(contextwrapper.java:318) 01-25 10:14:54.433: error/activitythread(5620): @ com.google.android.maps.networkconnectivitylistener.startlistening(mapactivity.java:163) 01-25 10:14:54.433: error/activitythread(5620): @ com.google.android.maps.mapactivity.onresume(mapactivity.java:431) 01-25 10:14:54.433: error/activitythread(5620): @ com.rossgreenhalf.maptest.activity.mymapactivity.onresume(mymapactivity.java:166) 01-25 10:14:54.433: error/activitythread(5620): @ android.app.instrumentation.callactivityonresume(instrumentation.java:1237) 01-25 10:14:54.433: error/activitythread(5620): @ android.app.activity.performresume(activity.java:3864) 01-25 10:14:54.433: error/activitythread(5620): @ android.app.activitythread.performresumeactivity(activitythread.java:3315) 01-25 10:14:54.433: error/activitythread(5620): @ android.app.activitythread.handleresumeactivity(activitythread.java:3340) 01-25 10:14:54.433: error/activitythread(5620): @ android.app.activitythread$h.handlemessage(activitythread.java:2158) 01-25 10:14:54.433: error/activitythread(5620): @ android.os.handler.dispatchmessage(handler.java:99) 01-25 10:14:54.433: error/activitythread(5620): @ android.os.looper.loop(looper.java:143) 01-25 10:14:54.433: error/activitythread(5620): @ android.app.activitythread.main(activitythread.java:4914) 01-25 10:14:54.433: error/activitythread(5620): @ java.lang.reflect.method.invokenative(native method) 01-25 10:14:54.433: error/activitythread(5620): @ java.lang.reflect.method.invoke(method.java:521) 01-25 10:14:54.433: error/activitythread(5620): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:858) 01-25 10:14:54.433: error/activitythread(5620): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) 01-25 10:14:54.433: error/activitythread(5620): @ dalvik.system.nativestart.main(native method)
am taking correct approach this? should concerned error?
i got same problem , after searching found post same issue
https://novoda.lighthouseapp.com/projects/63622/tickets/157-leak-receiver-searchresult
it suggests problem rises when using multiple map activities
within application.
so in manifest.xml file of app made each map activity run in separate process:
android:process=":p1" android:process=":p2"
you can read more in android docs. http://developer.android.com/guide/topics/manifest/activity-element.html#proc
Comments
Post a Comment