Code example for AppWidgetManager

Methods: getAppWidgetIds, updateAppWidget

0
		else if (intent.getAction().equals(STOP_BUTTON_PRESS))
			onStopButtonPressed(); 
		else if (intent.getAction().equals(NEXT_BUTTON_PRESS))
			onNextButtonPressed(); 
		 
		mAppWidgetManager.updateAppWidget(mAppWidgetManager.getAppWidgetIds(mComponentName), mRemoteViews);
	} 
 
	private void onNextButtonPressed() { 
		mRemoteViews.setTextViewText(R.id.currentplayingfilename, MediaPlayerController.getMusicName());
		MediaPlayerController.musicNext(); 
	} 
 
	private void onStopButtonPressed() { 
		mRemoteViews.setTextViewText(R.id.currentplayingfilename, "no music is playing");
		mRemoteViews.setImageViewResource(R.id.playbutton, R.drawable.ic_appwidget_music_play);
		 
		mRunning=false;
		MediaPlayerController.musicStop(); 
	}