我拿到了贴吧发帖记录的网址,怎么能用百度贴吧app打开这个网址,谢谢,第一次提问。
这个你得看百度贴吧app接受外部启动的时候是怎么写的了、
一般都是这样写的:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="xxx"
android:scheme="xxx" />
</intent-filter>
举个例子:
在微博里面打开知乎,会让你先去打开浏览器,然后会自动跳转到app里面、此时的连接地址是
api.zhihu.com/client/download?ct=..........
你如果在手机浏览器查看百度贴吧,一般都会自动跳到app中(如果你安装了百度贴吧app的话)。
无参数的
打开app
在AndroidManifest的清单文件里的intent-filte中加入如下元素:
<data
android:host="my.com"
android:scheme="m" />
有参数的
打开app
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Uri uri=Uri.parse(url);
if(uri.getScheme().equals("m")&&uri.getHost().equals("my.com")){
String arg0=uri.getQueryParameter("arg0");
String arg1=uri.getQueryParameter("arg1");
}else{
view.loadUrl(url);
}
return true;
}
});