【发布时间】:2014-09-02 18:12:07
【问题描述】:
我想在用户点击带有 linkify 的 textView 时打开 Activity... 这是我的代码:
Pattern tagMatcher = Pattern.Compile("#([A-Za-z0-9_-]+)");
//Scheme for Linkify, when a word matched tagMatcher pattern,
//that word is appended to this URL and used as content URI
String newActivityURL = "content://Solution.Project.WelcomeActivity";
//Attach Linkify to TextView
wrapper.Text.Text = post.PostText;
Linkify.AddLinks(wrapper.Text, tagMatcher, newActivityURL);
还有我的安卓manifest.xml
<application android:icon="@drawable/Icon" android:label="Welcome">
<activity android:name=".WelcomeActivity" android:label="@string/WelcomeText">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
</application>
当用户点击 textView 时,会抛出以下异常:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://Solution.Project.welcomeactivity (has extras) }
【问题讨论】:
标签: java android android-intent android-activity android-xml