Jam*_*ods 3 android commonsware android-4.0-ice-cream-sandwich autolink
我使用的android:autoLink设置为web一个TextView在我的Android应用程序,以使可点击的链接.但如果我在我的HTC Desire S升级到ICS上运行此操作,当我点击其中一个链接时,我得到以下异常
android.content.ActivityNotFoundException: Unable to find explicit activity class
{com.htc.HtcLinkifyDispatcher/
com.htc.HtcLinkifyDispatcher.HtcLinkifyDispatcherActivity};
have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1634)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1510)
at android.app.Activity.startActivityFromChild(Activity.java:3519)
at android.app.Activity.startActivityForResult(Activity.java:3271)
at android.app.Activity.startActivity(Activity.java:3358)
at woodsie.avalanche.info.InfoActivity.startActivity(InfoActivity.java:61)
at android.text.style.LinkifyURLSpan.onClick(LinkifyURLSpan.java:73)
Run Code Online (Sandbox Code Playgroud)
尝试注册HtcLinkifyDispatcherActivity让我无处可去,因为课程不在我的构建路径上.
Jam*_*ods 10
我发现与此相关的最佳文章是"链接问题:检测和缓解".
但是,我没有尝试拦截和替换URLSpan类,而是降低了一级,并覆盖startActivity()了TextView的父Activity.
@Override
public void startActivity(Intent intent) {
try {
/* First attempt at fixing an HTC broken by evil Apple patents. */
if (intent.getComponent() != null
&& ".HtcLinkifyDispatcherActivity".equals(intent.getComponent().getShortClassName()))
intent.setComponent(null);
super.startActivity(intent);
} catch (ActivityNotFoundException e) {
/*
* Probably an HTC broken by evil Apple patents. This is not perfect,
* but better than crashing the whole application.
*/
super.startActivity(Intent.createChooser(intent, null));
}
}
Run Code Online (Sandbox Code Playgroud)
Hacky但很简单,而且似乎有效.
| 归档时间: |
|
| 查看次数: |
1471 次 |
| 最近记录: |