Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.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 api v15中的活动互连_Android - Fatal编程技术网

Android api v15中的活动互连

Android api v15中的活动互连,android,Android,我有两个活动:第一个带有按钮的活动,通过意图调用第二个活动(打开文件对话框)。如何将文件名从第二个活动返回到第一个活动?有意的?哪种方法值得使用?需要使用api参考以下答案: 要启动另一个活动,仅从该活动获取响应(如您的情况),您可以使用:。在第二个活动中,您可以选择返回结果或取消结果 文件指出: The startActivity(Intent) method is used to start a new activity, which will be placed at the t

我有两个活动:第一个带有按钮的活动,通过意图调用第二个活动(打开文件对话框)。如何将文件名从第二个活动返回到第一个活动?有意的?哪种方法值得使用?需要使用api参考以下答案:

要启动另一个活动,仅从该活动获取响应(如您的情况),您可以使用:。在第二个活动中,您可以选择返回结果或取消结果

文件指出:

    The startActivity(Intent) method is used to start a new activity, which will be placed 
at the top of the activity stack. It takes a single argument, an Intent, which describes
the activity to be executed.

    Sometimes you want to get a result back from an activity when it ends. For example,
you may start an activity that lets the user pick a person in a list of contacts; when it 
ends, it returns the person that was selected. To do this, you call the 
startActivityForResult(Intent, int) version with a second integer parameter identifying 
the call. The result will come back through your onActivityResult(int, int, Intent) method.

    When an activity exits, it can call setResult(int) to return data back to its parent.
It must always supply a result code, which can be the standard results RESULT_CANCELED,
RESULT_OK, or any custom values starting at RESULT_FIRST_USER. In addition, it can 
optionally return back an Intent containing any additional data it wants. All of this 
information appears back on the parent's Activity.onActivityResult(), along with the 
integer identifier it originally supplied.

您可以使用intent..StartActivityForResult要求api>=16。我也必须支持api 15。@user2033775自api级别1以来,存在一个重载。