好的,所以这段代码在任何其他设备上都能正常工作,但在三星设备上会崩溃。我似乎不知道为什么,但我知道如果我使用TextView,它不会崩溃。但问题是,我需要这个字段的EditText,它可以包含多个链接。我花了一天的时间寻找一个没有用的解决方案,所以我想我应该在这里发布:
注意:这在我测试的Nexus和Motorola设备上似乎很有效:我想三星在处理EditText框中的链接时,有没有遗漏一些解决方法?
public class MainActivity extends Activity {
@Override
protected 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());
}
@Override
public 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;
}
}
如果有帮助的话,让我们来看看堆栈跟踪:
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)
android编辑视图中的可点击链接和复制/粘贴菜单
如果有人对答案感兴趣,这篇帖子对我有帮助。
自过去2个月以来,我们开始在开发人员控制台中接收到仅适用于部分三星设备的本机崩溃。 这是车祸痕迹 这是迄今为止收到崩溃的设备列表- 你知道为什么会这样吗? 这是构建。格拉德尔
我在Crashlytics上得到了这份坠机报告: 我看过这篇文章,但我不能在我的自定义课上做。 我怎样才能解决这个问题? StackTrace:
我正在使用Android Media Player从互联网流式传输音频文件(. mp3)。 除了三星设备外,它工作得很好。据我所知,它不会流式传输音频,而是尝试下载。它有时会推送媒体播放器错误(1-1004)。什么都没玩。 我还尝试将应用程序重定向到带有音频文件URL的媒体播放器,它将转到音乐播放器应用程序,指示“正在准备…”有一段时间,但随后它会在Toast中显示消息“抱歉,播放器不支持这种类型
我在android studio上运行应用程序时遇到了一个问题。已连接设备的列表将始终保持为空。因此,我无法在手机上部署我的应用程序。操作系统是Windows 10。 我已经采取了以下步骤: 安装了三星的驱动程序。该设备显示在设备管理器中,我可以从windows访问它 交换USB端口十几次 开发者设置 切换了摄像机(Ptp)和媒体设备(MTP)的媒体端口 有人有进一步的建议吗?
在为inApp相机实施camera2 API后,我注意到在三星设备上图像显得模糊。搜索之后,我找到了Sasmung Camera SDK(http://developer.samsung.com/galaxy#camera)。因此,在三星Galaxy S7上实施SDK后,图像现在很好,但在Galaxy S6上它们仍然模糊不清。有人在三星设备上遇到过这些问题吗? 编辑:补充@rcsumners的评论