Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.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 Intent.createChooser()?_Android_Dialog_Selection - Fatal编程技术网

如何使用Android Intent.createChooser()?

如何使用Android Intent.createChooser()?,android,dialog,selection,Android,Dialog,Selection,我正在尝试使用选择器,因此不必创建选择器对话框。可能是使用了错误的构造或小部件。所发生的事情是,我提供的意图列表被插入到选择器对话框中,但我设备上的所有其他应用程序也是如此。然后,如果我使用后退按钮,应用程序“完成” 调用是: Intent intentChooser = Intent.createChooser(intentDocumentView, "Choose A Chapter"); Parcelable [] parcelable = new Parcelable [2]; pa

我正在尝试使用选择器,因此不必创建选择器对话框。可能是使用了错误的构造或小部件。所发生的事情是,我提供的意图列表被插入到选择器对话框中,但我设备上的所有其他应用程序也是如此。然后,如果我使用后退按钮,应用程序“完成”

调用是:

Intent intentChooser = Intent.createChooser(intentDocumentView, "Choose A Chapter");

Parcelable [] parcelable = new Parcelable [2]; 
parcelable[0] = new LabeledIntent(intentDoc0, "com.mobibob.myapp", "Title 0", 0);
parcelable[1] = new LabeledIntent(intentDoc1, "com.mobibob.myapp", "Title 1", 0);
intentChooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, parcelable);
int whichDocument = RESULT_FIRST_USER;
startActivityForResult(intentChooser, whichDocument);

我是否需要在intentChooser中指定更多内容??类别旗帜?额外服务?

已经有一段时间了,但我遇到了类似的问题,谷歌让我转到你的帖子。只是想补充一点,我可以在这里找到一个解决方案->。祝你好运