码迷,mamicode.com
首页 > 移动开发 > 详细

android intent filter浏览器应用的设置,如何使用choose-box选择应用

时间:2015-07-23 15:25:12      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

//使用chooserIntent
private void startImplicitActivation() { Log.i(TAG, "Entered startImplicitActivation()"); // TODO - Create a base intent for viewing a URL // (HINT: second parameter uses Uri.parse()) Uri myUri = Uri.parse(URL); Intent baseIntent = new Intent(Intent.ACTION_VIEW, myUri); // TODO - Create a chooser intent, for choosing which Activity // will carry out the baseIntent // (HINT: Use the Intent class‘ createChooser() method) Intent chooserIntent = Intent.createChooser(baseIntent, "Display this url via .."); Log.i(TAG,"Chooser Intent Action:" + chooserIntent.getAction()); // TODO - Start the chooser Activity, using the chooser intent startActivity(chooserIntent); }

设置Intent-filter

1             <!-- TODO - Add necessary intent filter information so that this
2                     Activity will accept Intents with the
3                     action "android.intent.action.VIEW" and with an "http"
4                     schemed URL -->
5             <intent-filter>
6                 <action android:name="android.intent.action.VIEW" />
7                 <category android:name="android.intent.category.DEFAULT" />
8                 <data android:scheme="http"/>
9             </intent-filter>

 

android intent filter浏览器应用的设置,如何使用choose-box选择应用

标签:

原文地址:http://www.cnblogs.com/hitnoah/p/4670553.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!