【问题标题】:Action ACTION_IMAGE_CAPTURE shows package names instead of AppNames操作 ACTION_IMAGE_CAPTURE 显示包名称而不是 AppNames
【发布时间】:2014-10-31 14:02:30
【问题描述】:

当我创建 TAKE PHOTO 隐式意图时,会正确显示一个意图选择器窗口。不幸的是,它显示包名称而不是应用程序名称。知道我做错了什么吗?谢谢。

一切正常(意图、相机应用、返回到 onActivityResult 的图像……)。 如果只有一个相机应用程序 - 不显示选择,直接调用相机应用程序(正确)。 我安装的相机应用程序是:默认的安卓相机,谷歌相机。 在 3 款不同的三星手机上进行了测试。

private void dispatchTakePictureIntent() {
    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    // Ensure that there's a camera activity to handle the intent
    if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
        // Create the File where the photo should go
        File photoFile = null;
        try {
            photoFile = createImageFile();
        } catch (IOException ex) {
            Log.e(PoiDetailGalleryFragment.class.getSimpleName(), "Error occurred while creating the File", ex);
        }
        // Continue only if the File was successfully created
        if (photoFile != null) {
            Uri fileUri = Uri.fromFile(photoFile);
            takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
            startActivityForResult(takePictureIntent, REQUEST_PHOTO_CAPTURE);
        }
    }
}

【问题讨论】:

  • 会不会是语言问题?如果切换到英文用户界面,这还会显示包名吗?

标签: android android-intent camera package-managers


【解决方案1】:

我认为这个问题与三星设备有关,它们不显示应用程序名称,而只显示程序包名称。

Google Nexus 设备的行为不同,它们同时显示应用程序名称和包名称。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-27
    相关资源
    最近更新 更多