我想从链接上点击TextView来处理打开的URL意图,以便自己处理URL,而不是阻止打开默认浏览器应用选择器。接收器不工作
接收清单文件中:
<receiver android:name=".util.toolbox.LinkClickReceiver" android:exported="false">
<intent-filter
android:priority="300">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"/>
<data android:scheme="http"/>
</intent-filter>
</receiver>
接收机类:
public class LinkClickReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, intent.getDataString(), Toast.LENGTH_LONG);
}
}
的TextView到linkify文本:
Linkify.addLinks(noteView, Linkify.ALL);
我不能够进去的onReceive()方法?不能显示吐司。
您是否在接受过您的接收器的活动中注册了您的LinkClickReceiver? – linhtruong
你如何启动你的接收器? –
什么尝试实现? – Sush