I have create a widget in android , whenever i click on Widget TextView one service get starts but at the same time i want to change the icon which is shown on the right side.
I can set a onclick over Widget TextView using
remoteViews.setOnClickPendingIntent(R.id.widgetTxt,pendingIntent);
but i don’t know where i can change the icon when the TextView get clicks
image

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,int[] appWidgetIds) {
// Here i am trying to set a onclick over TextView
Intent intent = new Intent(context,MyService.class);
PendingIntent pendingIntent = PendingIntent.getService(context,0 ,
intent, 0);
remoteViews.setOnClickPendingIntent(R.id.MyWidgetTxt,pendingIntent);
}
When an icon itself gets clicked , it changes too and i have set its code in onReceive
try this :
In manifest.xml
In AppWidgetProvider.java :