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

//使用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>

 

转载于:https://www.cnblogs.com/hitnoah/p/4670553.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值