Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/202.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 意图:未显示默认应用程序选项_Android - Fatal编程技术网

Android 意图:未显示默认应用程序选项

Android 意图:未显示默认应用程序选项,android,Android,我的目的是让用户在Android设备上选择现有的图像。使用以下代码或类似代码,createChooser意图确实显示了选择设备上图像的多个选项(ASTRO、Gallery等),但没有显示“默认情况下用于此操作”复选框 Intent intent = new Intent(); intent.setType("image/jpg"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult( Inten

我的目的是让用户在Android设备上选择现有的图像。使用以下代码或类似代码,createChooser意图确实显示了选择设备上图像的多个选项(ASTRO、Gallery等),但没有显示“默认情况下用于此操作”复选框

Intent intent = new Intent();
intent.setType("image/jpg");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(
        Intent.createChooser(intent, "Select Picture"),
        PICK_IMAGE);

我一定是忽略了什么。我根据2.1、2.2和4.0.3编译了应用程序,但没有用。已在我的Nexus S、Galaxy S和emulator上试用。

如果使用
createChooser()
,则不会出现“默认使用此操作”复选框。如果您想要该复选框,请去掉
createChooser()
,只需将
intent
传递到
startActivityForResult()

谢谢您提供的宝贵信息!