【发布时间】:2014-12-05 13:35:39
【问题描述】:
我在尝试通过单击 textview 启动 Activity 时遇到异常。
这是用于访问活动的代码
tv1.setText(result+" ");
tv1.setEms(5);
Pattern pattern = Pattern.compile("[a-zA-Z/a-zA-Z]");
Linkify.addLinks(tv1, pattern,null);
tv1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent ourIntent = new Intent(Http_schedule.this, HttpSecondSchedule.class);
try {
ourIntent.putExtra("Voyage", (String)jo.get("Voyage"));
ourIntent.putExtra("Ship", jo.get("Ship").toString());
startActivity(ourIntent);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
tbrow2.addView(tv1);
这是我注册第二个活动的 android.manifest 文件
<activity
android:name=".HttpSecondSchedule"
android:label="Seat Availability"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize"
>
<intent-filter>
<action android:name="com.example.ship_service_list.HttpSecondSchedule" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
这是我得到的错误
12-05 08:16:38.600: E/InputEventReceiver(1458): Exception dispatching input event.
12-05 08:16:38.600: E/MessageQueue-JNI(1458): Exception in MessageQueue callback: handleReceiveCallback
12-05 08:16:38.770: E/MessageQueue-JNI(1458): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=v (has extras) }
12-05 08:16:38.770: E/MessageQueue-JNI(1458): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
12-05 08:16:38.770: E/MessageQueue-JNI(1458): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
]
【问题讨论】:
-
你在使用
NDK吗?错误似乎来自JNI -
模式模式 = Pattern.compile("[a-zA-Z/a-zA-Z]"); //Linkify.addLinks(tv1, pattern,null);我这样做了,错误消失了......有没有其他选择。
-
至少有人可以说如何使用 Linkify 调用活动。我是 android 新手,有一些帮助
-
您可能需要根据您的需要更新您的问题,我已经添加了
linkify标签
标签: android android-intent android-activity linkify