<TextView
android:id="@+id/text_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dip"
android:layout_marginRight="0dip"
android:layout_marginTop="8dip"
android:autoLink="web|email"
android:textColor="#000"
android:textSize="14sp" />
02-21 15:06:00.753: E/AndroidRuntime(14254): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=mailto:[email protected] (has extras) }
在textview中的文字为:
请访问[email protected].
请访问http://baidu.com
试过了点解email的时候会直接挂,点击百度链接则可以,求大家帮忙
解决办法:重写TextView的onTouchEvent(MotionEvent event)方法,对异常处理
此贴更换为散粉贴!!!
此贴更换为散粉贴!!!此贴更换为散粉贴!!!
此贴更换为散粉贴!!!
此贴更换为散粉贴!!!
此贴更换为散粉贴!!!
此贴更换为散粉贴!!!
此贴更换为散粉贴!!!
能不能具体点?
我现在遇到了这个问题,不知道怎么该改,onTouchEvent(MotionEvent event)里如何处理?
重写TextView
自己写一个继承与TextView的自定义控件,并将触发事件方法进行try catch处理,自己捕获异常就OK了
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
try {
return super.onTouchEvent(event);
} catch (Exception e) {
Toast.makeText(context, "链接出错", 1000).show();
}
return false; }还有其他不了解的,去网上搜下android自定义控件就好。