众所周知,在网页里,或者在mail里,点击超链接,就会在浏览器里,打开该页面,
那么,怎样做到,点击链接,就会启动我想启动的程序呢?注意,这是在android里面。
我知道就是,在自己的程序里面写个broadcast reciever.监听事件。然后在用户 点击该链接 这个事件里,就可以sendbroadcast,让自己程序来响应。
但是,问题是,我如何捕获到用户点击链接这个链接?
那么,怎样做到,点击链接,就会启动我想启动的程序呢?注意,这是在android里面。
我知道就是,在自己的程序里面写个broadcast reciever.监听事件。然后在用户 点击该链接 这个事件里,就可以sendbroadcast,让自己程序来响应。
但是,问题是,我如何捕获到用户点击链接这个链接?
解决方案 »
- 关于蓝牙socket 服务器端首次accept总出错!
- 关于android短信拦截的问题
- android
- opencore testbed一个omx组件
- Fragment替换布局中的view时,如何保持view的宽高属性
- androidx86 4.0编译碰到问题
- 求助!!!调用httpconnection.getInputStream方法总是出io异常,求大神解决!
- requestlocationupdates参数的问题
- error: 'jstringToString' was not declared in this scope
- 怎样让控件按特定轨迹移动?
- 真机android 2.2编译升级至 android 2.3.4 源码的步骤是怎么样的?
- Android 软键盘样式的指定方法
text, with a <a href="http://www.google.com">link</a> specified
via an <a> tag. Use a \"tel:\" URL
to <a href="tel:4155551212">dial a phone number</a>.
</string>ApiDemos里有的
TextView t3 = (TextView) findViewById(R.id.text3);
t3.setText(
Html.fromHtml(
"<b>text3:</b> Text with a " +
"<a href=\"http://www.google.com\">link</a> " +
"created in the Java source code using HTML."));
t3.setMovementMethod(LinkMovementMethod.getInstance());
就像UC一样,如果你装了UC的话,好像,只要你是点击链接的话,都会给你选择,让你用Browser打开,还是用UC打开。
记得在哪看见过 不知道有没有用 关注
关注ing
在自己程序Activity里面加个
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
然后,这个ActivitY就可以像UC一样响应超链接了。(哈哈,这个是我反编译UC看到的)
楼上也说的对,我们自己如果有别的schema,就自己定义个就OK了。
这个东西 直接加在.xml中就可以了
这个不用反编译,多看看android的browser的源码,browser的androidmanifest.xml写的很清楚的
本来我以为要broadcast,但实际上不用。直接用activity就可以。
还有,用broadcast,好像不work.只能用activity.求高手分析……
http://orgcent.com/android-textview-no-underline-hyperlink/