I can't find a way to pass extras from widget to Activity
properly.
I wan't to open activity on button click with some extras passed.
Intent intent = new Intent(context, CreateOperationsActivity.class);
intent.putExtra("someKey", true);
PendingIntent pendingIntent = PendingIntent.getActivity(context, Constants.RequestCodes.CREATE_OPERATIONS, intent, PendingIntent.FLAG_UPDATE_CURRENT);
views.setOnClickPendingIntent(R.id.add_expense_button, pendingIntent);
Activity is opened, but there is no extra in the Intent
.
The only way I was able to pass that extra was seting PendingIntent
flag to PendingIntent.FLAG_ONE_SHOT
but then widget button works only wonce, clicking it further takes no action.
How to do that so the extra is intercepted by Activity
and the button works each time?