android – 三星设备崩溃包含链接的EditText

android – 三星设备崩溃包含链接的EditText,第1张

概述好的,所以这个代码在任何其他设备上都能正常工作,但三星设备崩溃.我似乎不明白为什么真的,但我知道如果我使用一个TextView它不会崩溃.问题是,我需要这个字段的EditText,它可以包含多个链接.我过去一天在寻找解决方案无济于事,所以我以为我会在这里发贴: 注意:这似乎适用于我测试的Nexus和Motorola设备: 有没有一些解决方法,我可能会错过,因为我将要猜测三星扮演如何处理EditTe 好的,所以这个代码在任何其他设备上都能正常工作,但三星设备崩溃.我似乎不明白为什么真的,但我知道如果我使用一个TextVIEw它不会崩溃.问题是,我需要这个字段的EditText,它可以包含多个链接.我过去一天在寻找解决方案无济于事,所以我以为我会在这里发贴:

注意:这似乎适用于我测试的Nexus和Motorola设备:
有没有一些解决方法,我可能会错过,因为我将要猜测三星扮演如何处理EditText框中的链接?

public class MainActivity extends Activity {@OverrIDeprotected voID onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentVIEw(R.layout.activity_main);      EditText t3 = (EditText) 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());}@OverrIDepublic boolean onCreateOptionsMenu(Menu menu) {    // Inflate the menu; this adds items to the action bar if it is present.    getMenuInflater().inflate(R.menu.main,menu);    return true;}}

这里有一个stacktrace,如果这有助于:

03-21 11:17:34.897: E/AndroIDRuntime(1810): FATAL EXCEPTION: main    03-21 11:17:34.897: E/AndroIDRuntime(1810): java.lang.NullPointerException    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.Widget.Editor.ontouchUpEvent(Editor.java:1927)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.Widget.TextVIEw.ontouchEvent(TextVIEw.java:8865)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEw.dispatchtouchEvent(VIEw.java:7817)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwGroup.dispatchtransformedtouchEvent(VIEwGroup.java:2441)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwGroup.dispatchtouchEvent(VIEwGroup.java:2174)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwGroup.dispatchtransformedtouchEvent(VIEwGroup.java:2441)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwGroup.dispatchtouchEvent(VIEwGroup.java:2174)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwGroup.dispatchtransformedtouchEvent(VIEwGroup.java:2441)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwGroup.dispatchtouchEvent(VIEwGroup.java:2174)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwGroup.dispatchtransformedtouchEvent(VIEwGroup.java:2441)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwGroup.dispatchtouchEvent(VIEwGroup.java:2174)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at com.androID.internal.policy.impl.PhoneWindow$DecorVIEw.superdispatchtouchEvent(PhoneWindow.java:2326)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at com.androID.internal.policy.impl.PhoneWindow.superdispatchtouchEvent(PhoneWindow.java:1612)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.app.Activity.dispatchtouchEvent(Activity.java:2494)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at com.androID.internal.policy.impl.PhoneWindow$DecorVIEw.dispatchtouchEvent(PhoneWindow.java:2274)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEw.dispatchPointerEvent(VIEw.java:8025)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$VIEwPostImeinputStage.processpointerEvent(VIEwRootImpl.java:4668)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$VIEwPostImeinputStage.onProcess(VIEwRootImpl.java:4556)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$inputStage.deliver(VIEwRootImpl.java:4150)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$inputStage.onDeliverToNext(VIEwRootImpl.java:4207)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$inputStage.forward(VIEwRootImpl.java:4176)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$AsyncinputStage.forward(VIEwRootImpl.java:4261)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$inputStage.apply(VIEwRootImpl.java:4184)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$AsyncinputStage.apply(VIEwRootImpl.java:4318)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$inputStage.deliver(VIEwRootImpl.java:4150)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$inputStage.onDeliverToNext(VIEwRootImpl.java:4207)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$inputStage.forward(VIEwRootImpl.java:4176)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$inputStage.apply(VIEwRootImpl.java:4184)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$inputStage.deliver(VIEwRootImpl.java:4150)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl.deliverinputEvent(VIEwRootImpl.java:6302)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl.doProcessinputEvents(VIEwRootImpl.java:6240)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl.enqueueinputEvent(VIEwRootImpl.java:6211)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.VIEwRootImpl$WindowinputEventReceiver.oninputEvent(VIEwRootImpl.java:6382)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.vIEw.inputEventReceiver.dispatchinputEvent(inputEventReceiver.java:188)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.os.MessageQueue.nativePollOnce(Native Method)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.os.MessageQueue.next(MessageQueue.java:132)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.os.Looper.loop(Looper.java:124)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at androID.app.ActivityThread.main(ActivityThread.java:5455)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at java.lang.reflect.Method.invokeNative(Native Method)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at java.lang.reflect.Method.invoke(Method.java:525)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:1003)    03-21 11:17:34.897: E/AndroIDRuntime(1810):     at dalvik.system.NativeStart.main(Native Method)
解决方法 Clickable links and copy/paste menu in EditView in android

这个帖子帮助我,如果有人对答案感兴趣.

总结

以上是内存溢出为你收集整理的android – 三星设备崩溃包含链接的EditText全部内容,希望文章能够帮你解决android – 三星设备崩溃包含链接的EditText所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1134032.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存