Back to project page audioplayer.
The source code is released under:
GNU General Public License
If you think the Android project audioplayer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package fr.julien_dumortier.simplemusicplayer.widget; /*from www .j a va 2 s. co m*/ import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; public class AudioPlayerWidgetProvider extends AppWidgetProvider { public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); for (int x : appWidgetIds) { ((AudioPlayerApplication) context.getApplicationContext()).deleteWidget(x); } } public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); for (int x : appWidgetIds) { ((AudioPlayerApplication) context.getApplicationContext()).createWidget(x); } } public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); AudioPlayerApplication application = ((AudioPlayerApplication) context.getApplicationContext()); if (intent.getAction().startsWith("fr.julien_dumortier") && application.getMusicPlayerService() != null) { // int widgetId = intent.getIntExtra(WidgetView.WIDGET_ID, 0); int function = intent.getIntExtra(WidgetView.FUNCTION, -1); switch(function) { case WidgetView.ACTION_LAST: application.getMusicPlayerService().getMusicMediaPlayer().last(); break; case WidgetView.ACTION_NEXT: application.getMusicPlayerService().getMusicMediaPlayer().next(); break; } } } }