Looking to get started on designing an appwidget and find that none of the tutorials on android.com have information on dealing with buttons (and other UI elements)?
I found a nice tutorial that deals with those issues and is pretty easy to follow:
http://www.helloandroid.com/files/xmaswidget/android_howto-hellowidget.pdf
Leave a comment if you've found it helpful.
Showing posts with label appwidget. Show all posts
Showing posts with label appwidget. Show all posts
Thursday, October 14, 2010
Monday, October 11, 2010
Appwidget lifetimes and persistance of data
So tonight's aggravation was caused by the letter null. Basically I couldn't figure out when I was trying to get my Speed Widget to work, why I could create a locationManager and initialize it, but subsequent calls would throw a NullPointerException.
The solution (as with most things), was to RTFM. If you look at the documentation for BroadcastReceiver (Which AppWidgetProvider is extended from), you would see:
The solution (as with most things), was to RTFM. If you look at the documentation for BroadcastReceiver (Which AppWidgetProvider is extended from), you would see:
A BroadcastReceiver object is only valid for the duration of the call to onReceive(Context, Intent).So that pretty much solved why my local variables were disappearing each time. I figured that appwidgets had funky lifetimes, I just didn't know where to look.
Subscribe to:
Posts (Atom)