Android KitKat Не показывать изображение с камеры на Nexus 4 (Android 4.4)

У меня возникла проблема, когда я вызвал свой код ниже с устройств Android, они показывают галерею и камеру, но когда я запускаю этот код на Nexus 4 (android v4.4, KitKat), он не показывает выбор камеры. Показана только Галерея.

Пожалуйста, помогите мне в этом вопросе

Спасибо, :)

private Uri    outputFileUri = null;
private String pathImage     = null;

private void chooseImage() {
    // Determine Uri of camera image to save.
    final File root = new File(Environment.getExternalStorageDirectory() + File.separator + getString(R.string.app_name) + File.separator);
    root.mkdirs();
    final String fname = String.valueOf(System.currentTimeMillis());
    final File sdImageMainDirectory = new File(root, fname);
    outputFileUri = Uri.fromFile(sdImageMainDirectory);

    // Camera.
    final List<Intent> cameraIntents = new ArrayList<Intent>();
    final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    final PackageManager packageManager = getPackageManager();
    final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0);
    for(ResolveInfo res : listCam) {
        final String packageName = res.activityInfo.packageName;
        final Intent intent = new Intent(captureIntent);
        intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
        intent.setPackage(packageName);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
        cameraIntents.add(intent);
    }

    // Filesystem.
    final Intent galleryIntent = new Intent(Intent.ACTION_PICK);
    galleryIntent.setType("image/*");

    // Chooser of filesystem options.
    final Intent chooserIntent = Intent.createChooser(galleryIntent, getString(R.string.title_pick_photo));

    // Add the camera options.
    chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[]{}));

    startActivityForResult(chooserIntent, IActivity.PICK_GALLERY);
}

person sonida    schedule 04.12.2013    source источник
comment
Похоже, это баг Android. См. связанный вопрос «на Android API 19 4 4 метод намерения createchooser вызывает намерениеserviceleak»> stackoverflow.com/questions/19827280/ и ошибка зарегистрирована на Android code.google.com/p/android/issues/detail?id=61937   -  person Maragues    schedule 05.12.2013