> I want to build a widget to show the most contacted person. > > The widget will be displaying only one contact at a time, with some > details. But, I also want to keep a button on the widget, so that when > the button is clicked (eg, Next), the next most contacted contact > details should be shown. > > Is this possible, if yes, how can I achieve this ?
Adding a button to the widget is just a matter of putting it in your layout. In your code, you can attach a PendingIntent to be invoked when that button is clicked. You can see that in one of the samples out of my _Android Programming Tutorials_ book: http://github.com/commonsguy/cw-andtutorials/tree/master/36-AdvAppWidget/ For your case, though, the challenge is in the "next most contacted contact" part. Widgets have no real state, so either you would need to teach the Button's PendingIntent what the "next most contacted contact" is, or you would have to keep a file or database table or something that knows what the widget is currently showing, so you can determine what is "next" to be shown. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html
-- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en