I have a widget that when pressed opens the activity. I do it like this:
Piece of code:
try {
Intent defineIntent2 = new Intent(context,
Setting.class);
PendingIntent pendingIntent2 = PendingIntent
.getActivity(context, 0 /* no requestCode */,
defineIntent2, 0 /* no flags */);
updateViews
.setOnClickPendingIntent(R.id.widget, pendingIntent2);
} catch (Exception e) {
Log.e(LOG_TAG, "", e);
}
return updateViews;
}
I want that by pressing widget the music start. I tried to do to play in the activity. This works, but the problem is I need to close the activity "by hand".
There is another way of releasing music when pressed?