Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/205.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,这是我的设想 浏览器(Chrome、Firefox…)使用我的内容方案调用我的应用程序 myscheme://urltoparse 在我的应用程序中,我想在同一页面上返回一个新的url(失败或成功) //For the moment I Just arrive to create a new page in the browser Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://mysite/fail.html")

这是我的设想

浏览器(Chrome、Firefox…)使用我的内容方案调用我的应用程序 myscheme://urltoparse

在我的应用程序中,我想在同一页面上返回一个新的url(失败或成功)

//For the moment I Just arrive to create a new page in the browser
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://mysite/fail.html"));
startActivity(intent); //create new page

finish();

如果有人有想法…

如果我理解正确,那么一个应用程序(通过浏览器)调用了您的应用程序,您想返回应用程序的答案吗? 方法是调用您的应用程序的应用程序将使用以下函数:

Intent i = new Intent (this, SecondActivity.class);
startActivityForResult (i, 1);
您将使用:

Intent returnIntent = new Intent ();
returnIntent.putExtra ("result", result);
setResult (RESULT_OK, returnIntent);
finish ();
调用您的应用程序实现回调:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

if (requestCode == 1) {
    if(resultCode == RESULT_OK){
        String result=data.getStringExtra("result");
    }
    if (resultCode == RESULT_CANCELED) {
        //Write your code if there's no result
    }
 }
}//onActivityResult

如果你的意思是别的,请解释一下,我会尽力帮助你。

调用我的应用程序的应用程序是谷歌浏览器、Firefox。。。带url“myscheme://urltoparse“。如果您的应用程序是从浏览器调用的,则您无法返回到该应用程序并返回数据。您可以使用所需的特定url从应用程序打开浏览器。但是,如果您的应用程序是从web应用程序调用的,那么会有一个管理会话,您可以返回自己的数据。您称之为“web应用程序”是什么?Chrome Firefox?web应用程序是在web浏览器中运行的任何软件。它是用浏览器支持的编程语言(如JavaScript、HTML和CSS的组合)创建的,并依赖web浏览器呈现应用程序。在这种情况下,应用程序管理会话,可以访问用户/其他应用程序,并与用户/其他应用程序进行交互,向他们发送参数,了解如何获取信息。