I am developing an Android widget, and I have displayed some data of this widget from a web service and its performance. This is the code for this.
CODE
public class WatchWidget extends AppWidgetProvider{ private static final String TAG = "WatchWidget"; @Override public void onUpdate( Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds ){ Log.i(TAG, "* onUpdate"); EBWeaterData ebwd=new EBWeaterData(); EBWeatreUtils.getWeatherFeeds(context, ebwd, "my url to get data"); RemoteViews views = new RemoteViews(context.getPackageName(),R.layout.main); RemoteViews newView = new RemoteViews(context.getPackageName(), R.layout.test);
I have a button in this widget, now I want to update the widget view with different values when the user clicks the button. I know what I should do with this pendingIntent, as shown below.
Intent intent = new Intent(context, activitytogetNewdata.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.imageView1, pendingIntent);
But he will start another activity, I do not want to go to another game. I just need to update the same kind of widgets with the new values after clicking the button. Any idea
source share