3

I created a home screen widget (1*1) and I am trying to open the intent chooser for the camera and the gallery from that widget. I tried opening intent chooser from other class but it's not working. Here is the code from my configuration activity:

Intent clickIntent = new Intent(ConfigurationActivity.this, WidgetProviderSmall.class);
clickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);

PendingIntent pendingIntent = PendingIntent.getBroadcast(ConfigurationActivity.this, mAppWidgetId, clickIntent, 0);
views.setOnClickPendingIntent(R.id.img_widget, pendingIntent);
appWidgetManager.updateAppWidget(mAppWidgetId, views);

This is from my AppWidgetProvider class:

@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction()==null) {
        Bundle extras = intent.getExtras();
        if(extras!=null) {              
            class.OpenIntentChooser();
        }
    }
    else {
        super.onReceive(context, intent);
    }
}

Any suggestions?

Eel Lee
  • 3,513
  • 2
  • 31
  • 49
ramya
  • 368
  • 1
  • 14
  • this : http://stackoverflow.com/questions/11732872/android-how-can-i-call-camera-or-gallery-intent-together – Krishna Kachhela Aug 19 '16 at 12:05
  • Please provide a [mcve]. That would include the implementation of `OpenIntentChooser()` and an explanation of what "it's not working" means. Also, check your LogCat. If I had to guess, you are not including `FLAG_ACTIVITY_NEW_TASK` on your `Intent` that you are using to start the activity. That is required when starting an activity from a `BroadcastReceiver`. The LogCat message would point this out to you. – CommonsWare Aug 19 '16 at 13:02

0 Answers0