Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.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
Java 如何知道在IntentServer的接收器中选择了哪个操作?_Java_Android_Broadcastreceiver - Fatal编程技术网

Java 如何知道在IntentServer的接收器中选择了哪个操作?

Java 如何知道在IntentServer的接收器中选择了哪个操作?,java,android,broadcastreceiver,Java,Android,Broadcastreceiver,我试图知道我在意图中提供的哪些操作是用户选择的: 到目前为止,我已经尝试了以下代码: 关于我的主要活动: Intent receiver = new Intent(getBaseContext(), FileChoosingReceiver.class) .putExtra("test", "test"); PendingIntent pendingIntent = PendingIntent.getBroadcast(ge

我试图知道我在意图中提供的哪些操作是用户选择的:

到目前为止,我已经尝试了以下代码:

关于我的主要活动:

Intent receiver = new Intent(getBaseContext(), FileChoosingReceiver.class)
                                    .putExtra("test", "test");
PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, receiver, PendingIntent.FLAG_UPDATE_CURRENT);

Intent intent = new Intent(Intent.ACTION_CHOOSER);
Intent chooserIntent=Intent.createChooser(intent, "Seleccione modo", pendingIntent.getIntentSender());
chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
startActivityForResult(chooserIntent, file_req_code);
在我的清单上,我将接收者定义为:

<receiver android:name="com.example.webviewforgeoserver.FileChoosingReceiver" >
        </receiver>
当一个动作被调用时,onReceive被调用,但是…我看不到任何选项,无论是在上下文参数还是在意图参数中,都不允许我区分一个动作和另一个动作


我遗漏了什么可以让我知道哪些可用选项是所选的?

我希望
数据
方面、额外的内容或
意图
中的其他内容来识别所选项目。如果您在调试器中检查
Intent
,或者将其转储到Logcat,您看到了什么吗?@commonware,没有,我在调试器中打开了这两个参数,并仔细查看了它们的所有字段,但我甚至没有看到一个似乎与所选选项相关的字段。我希望看到
数据
方面,一个额外的,或
意图中的其他内容来识别所选项目。如果您在调试器中检查
Intent
,或者将其转储到Logcat,您看到了什么吗?@commonware,没有,我在调试器中打开了这两个参数,并仔细查看了它们的所有字段,但我甚至没有看到与所选选项相关的字段。
public class FileChoosingReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(final Context context, Intent intent) {



    }

}