[android-developers] Android Widget update problem
Hi, I have made a android widget for my application. I have used a layout(linear) in the xml of the widget. There is a textview showing some text in that layout. Now i want to change the text of the textview on tapping or clicking the layout. Can any one help me to do that. Thanks, RawCoder -- 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
Re: [android-developers] Android Widget update problem
write the onclick event for layout ,and inside of click event we can set the 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Android Widget update problem
But there is only views.setOnClickPendingIntent(R.id.tipslayout, actionPendingIntent); this method for widget. I didnot get any setonclicklistener(). Can u please provide an example code for me? On Mon, Sep 26, 2011 at 6:19 PM, tamil maran tam.mara...@gmail.com wrote: write the onclick event for layout ,and inside of click event we can set the 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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
Re: [android-developers] Android Widget update problem
You need to create a pending intent which will send an event to your widget, then handle that event in your widget Intent intent = new Intent(context, MightyToggleWidget.class); intent.setAction(MY_HANDLE_BUTTON_EVENT_NAME); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0); views.setOnClickPendingIntent(button, pendingIntent); This will make the MY_HANDLE_BUTTON_EVENT_NAME event to be broadcast. Now you need to handle this event in your AppWidgetProvider implementation ...To do this you need to tell Android O/S that your AppWidgetProvider will handle the event, you do this by adding an entry in the intent-filter section like so:- action android:name=MY_HANDLE_BUTTON_EVENT_NAME / Now you need to actually handle the event. You need to override AppWidgetProvider's onReceive like so: - @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (intent.getAction().equals(MY_HANDLE_BUTTON_EVENT_NAME){ doSomething(); } } I hope this helps! All the best, Ash -- 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