Hi Noam, I'd recommend taking a look at Megha's sample version: http://groups.google.com/group/android-developers/msg/5a5dc19ae00eb25b This is what I used as the basis for my map activity, and it solved a lot of the problems I was having before. It's easier to use that as a starting point and adapt it to your activity than try and chase down individual bugs.
Good luck! - Chris On Apr 10, 10:19 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Ok, but now it gives me this error: > > Unable to pause activity [package]: > java.lang.IllegalArgumentException: Receiver not registered: [package]$ > [IntentReceiver]. > > Why is this happening? > > Thanks, > Noam. > > On Apr 10, 8:14 am, cirion <[EMAIL PROTECTED]> wrote: > > > You should UNregister the receiver in onPause. Your activity is going > > away, so you don't want to receive any more broadcasts. > > > On Apr 9, 1:10 pm, "Noam Habot" <[EMAIL PROTECTED]> wrote: > > > > Ok..this is my onPause: > > > > @Override > > > public void onPause() { > > > this.registerReceiver(this.myIntentReceiver, this.myIntentFilter); > > > super.onPause(); > > > } > > > > It doesn't give the error I posted 2 minutes ago, but it gives the error > > > "error receiving broadcast null in [package]$[IntentReceiver]". > > > > Thanks, > > > Noam. > > > > On Wed, Apr 9, 2008 at 1:07 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > > > wrote: > > > > > Now it tells me that the receiver isn't registered: > > > > > Unable to pause activity [package]: > > > > java.lang.IllegalArgumentException: Receiver not registered: [package]$ > > > > [IntentReceiver]. > > > > > Why is this happening? > > > > > Thanks, > > > > Noam. > > > > > On Apr 9, 12:54 pm, cirion <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > > unregisterReceiver should definitely be called from onPause. onFreeze > > > > > will only get called if another Activity is starting and your own > > > > > Activity may be destroyed. In contrast, onPause will be called every > > > > > time your Activity stops displaying. > > > > > > Hope this helps, > > > > > Chris > > > > > > On Apr 9, 12:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > > > wrote: > > > > > > > I don't have an onPause. Could this be the problem? > > > > > > However, I have a onResume and a onFreeze: > > > > > > > @Override > > > > > > public void onFreeze(Bundle icicle) { > > > > > > this.unregisterReceiver(this.myIntentReceiver); > > > > > > super.onFreeze(icicle); > > > > > > } > > > > > > @Override > > > > > > public void onResume() { > > > > > > super.onResume(); > > > > > > this.registerReceiver(this.myIntentReceiver, > > > > > > this.myIntentFilter); > > > > > > } > > > > > > > What am I doing wrong? > > > > > > > Thanks, > > > > > > Noam. > > > > > > > On Apr 9, 9:18 am, Hielko <[EMAIL PROTECTED]> wrote: > > > > > > > > Check if your onResume and onPause methods are called properly. > > > > There > > > > > > > are some bugs in the lifecycle model, sometimes onPauze will be > > > > called > > > > > > > but onResume isn't called when you go back to the activity so that > > > > > > > could generate some problems. > > > > > > > > On Apr 9, 5:54 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > > > > > wrote: > > > > > > > > > I tried emulator -wipe-data and it still doesn't work..Does > > > > > > > > anyone > > > > > > > > have a suggestion? > > > > > > > > > Thanks, > > > > > > > > Noam. > > > > > > > > > On Mar 13, 9:33 pm, cirion <[EMAIL PROTECTED]> wrote: > > > > > > > > > > Argh, never mind. This seems to be one of those problems that > > > > can be > > > > > > > > > fixed with emulator -wipe-data. > > > > > > > > > > On Mar 13, 7:47 pm, cirion <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > I'm having the exact same problem. This is in a > > > > > > > > > > MapActivity. > > > > Does > > > > > > > > > > anyone know of a solution? Thanks! > > > > > > > > > > > On Mar 7, 3:46 am, Mark <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > Occassionally, I am getting an exception like this when I > > > > finish my > > > > > > > > > > > activity. > > > > > > > > > > > >ERROR/AndroidRuntime(605): > > > > java.lang.RuntimeException:Errorreceiving > > > > > > > > > > >broadcastnullin [EMAIL PROTECTED] > > > > > > > > > > >ERROR/AndroidRuntime(605): at > > > > > > > > > > >android.app.ActivityThread > > > > > > > > > > > $PackageInfo$ReceiverDispatcher.run(ActivityThread.java:492) > > > > > > > > > > >ERROR/AndroidRuntime(605): at > > > > > > > > > > > android.os.Handler.handleCallback(Handler.java:455) > > > > > > > > > > >ERROR/AndroidRuntime(605): at > > > > > > > > > > > android.os.Handler.dispatchMessage(Handler.java:78) > > > > > > > > > > >ERROR/AndroidRuntime(605): at > > > > android.os.Looper.loop(Looper.java: > > > > > > > > > > > 91) > > > > > > > > > > >ERROR/AndroidRuntime(605): at > > > > > > > > > > > android.app.ActivityThread.main(ActivityThread.java:3052) > > > > > > > > > > >ERROR/AndroidRuntime(605): at > > > > > > > > > > > java.lang.reflect.Method.invokeNative(Native Method) > > > > > > > > > > >ERROR/AndroidRuntime(605): at > > > > > > > > > > > java.lang.reflect.Method.invoke(Method.java:356) > > > > > > > > > > >ERROR/AndroidRuntime(605): at android.os.ZygoteInit > > > > > > > > > > > $MethodAndArgsCaller.run(ZygoteInit.java:1547) > > > > > > > > > > >ERROR/AndroidRuntime(605): at > > > > > > > > > > > android.os.ZygoteInit.main(ZygoteInit.java:1445) > > > > > > > > > > >ERROR/AndroidRuntime(605): at > > > > > > > > > > > android.dalvik.NativeStart.main(Native Method) > > > > > > > > > > >ERROR/AndroidRuntime(605): Caused by: > > > > java.lang.NullPointerException > > > > > > > > > > >ERROR/AndroidRuntime(605): at > > > > > > > > > > >android.app.ActivityThread > > > > > > > > > > > $PackageInfo$ReceiverDispatcher.run(ActivityThread.java:476) > > > > > > > > > > >ERROR/AndroidRuntime(605): ... 9 more > > > > > > > > > > > > Inside my activity, I am using an IntentReceiver as a > > > > > > > > > > > inner > > > > class to > > > > > > > > > > > receive location update from location manager. I register > > > > the > > > > > > > > > > > IntentFilter and call requestUpdates in onResume, and > > > > unregister and > > > > > > > > > > > removeUpdates in onPause. I don't think this exception is > > > > generated by > > > > > > > > > > > my onReceiveIntent code, as I have tried to place a try > > > > catch block > > > > > > > > > > > around all the code and this still happens. Has anyone had > > > > similar > > > > > > > > > > > problem?- Hide quoted text - > > > > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > > > > - Show quoted text --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---