Reputation: 368
I tried opening the activity from the widget from the below code`
Intent defineIntent = new Intent(ConfigurationActivity.this,EditActivity.class);
defineIntent.putExtra("from_widget",true);
PendingIntent pendingIntent1 = PendingIntent.getActivity(ConfigurationActivity.this,0 /* no requestCode */, defineIntent, 0 /* no flags */);
views.setOnClickPendingIntent(R.id.img_widget, pendingIntent1);
but I don't have idea to identify the activity that is opened from widget.
Upvotes: 2
Views: 84
Reputation: 1383
In the EditActivity's onCreate() method, write this code:
boolean isFromWidget = getIntent().getStringExtra("from_widget",false);
This code will get the value from the previous Activity. "isFromWidget" is true means the activity is opened from widget.
Upvotes: 1