-1

Hi i am new android developer and i am working on an android app in which i want to show a dialog to user to select image from camera or gallery and after user selects image i want to store it in SD Card.i have already done it for OS versions less than 4.4 but i want to do this for 4.4 and above versions.i have already visited link Android kitkat Image Selection From Gallery Issue Please give some code examples as well as guidance. Thanks in advance

Community
  • 1
  • 1

1 Answers1

0

create the final list of possible Intents with one new Intent for each retrieved activity like this:

List<Intent> yourIntentsList = new ArrayList<Intent>();
List<ResolveInfo> listCam = packageManager.queryIntentActivities(camIntent, 0);
for (ResolveInfo res : listCam) {
    final Intent finalIntent = new Intent(camIntent);
    finalIntent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
    yourIntentsList.add(finalIntent);
}

List<ResolveInfo> listGall = packageManager.queryIntentActivities(gallIntent, 0);
for (ResolveInfo res : listGall) {
    final Intent finalIntent = new Intent(gallIntent);
    finalIntent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
    yourIntentsList.add(finalIntent);
}
Maveňツ
  • 1
  • 12
  • 50
  • 89