jjzjj

classCastException

全部标签

Android:support.v4.app.Fragment -> Fragment classcastexception 的解决方法?

我正在尝试将support.v4.app.Fragment添加到PreferenceActivityheader,如下所示:这会抛出一个ClassCastException,大概是因为PreferenceActivity需要一个android.app.Fragment的子类,而不是support.v4.app.Fragment。我的用例是这样的:我有非标准fragment,我想在3.0设备上用作首选项。对于>=3.0,我需要一个android.app.Fragment子类,以便它可以嵌入到平板设备上首选项Activity的“详细信息Pane”中。对于v4.support.app.Fra

android - 添加 LayoutParams 时出现 ClassCastException

在设置LinearLayout的LayoutParams时,我必须使用哪个类?以下两个不起作用:linLayout.setLayoutParams(newViewGroup.LayoutParams(50,50));linLayout.setLayoutParams(newandroid.widget.LinearLayout.LayoutParams(50,50));如果我先获取参数,更改它们并将它们重新设置,它就可以正常工作。所以我想我返回的参数继承自ViewGroup.LayoutParams...有什么想法吗?谢谢 最佳答案

findViewById 上的 android ClassCastException

我遇到了一个小问题,我找不到我犯的错误,这可能真的很简单。我有以下布局当我尝试使用findViewById从中获取View时,出现了ClassCast异常11-2310:12:07.680:E/AndroidRuntime(5965):FATALEXCEPTION:main11-2310:12:07.680:E/AndroidRuntime(5965):java.lang.ClassCastException:android.widget.ImageView11-2310:12:07.680:E/AndroidRuntime(5965):atcom.bilobait.taskbox.t

android - ClassCastException : android. 无法转换 os.BinderProxy

我收到这个ClassCaseException-/ActivityManager(213):Badactivitytoken:android.os.BinderProxy@420b43f0W/ActivityManager(213):java.lang.ClassCastException:android.os.BinderProxycannotbecasttocom.android.server.am.ActivityRecord$TokenW/ActivityManager(213):atcom.android.server.am.ActivityRecord.forToken(A

android - PreferenceActivity 中的 ClassCastException

我正在尝试从RetoMeier的Android2应用程序开发一书中获取示例(第202页)。根据说明,我创建了一个userpreferences.xml,如下所示:我的Preferences类看起来像这样......publicclassPreferencesextendsPreferenceActivity{SharedPreferencesprefs;@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);addPreferencesFromResource(R.

android - 使用 LinearLayout.LayoutParams 时出现 ClassCastException

这是异常(exception)情况:07-2019:52:14.193:E/AndroidRuntime(3908):FATALEXCEPTION:main07-2019:52:14.193:E/AndroidRuntime(3908):java.lang.ClassCastException:android.view.ViewGroup$LayoutParamscannotbecasttoandroid.widget.LinearLayout$LayoutParams07-2019:52:14.193:E/AndroidRuntime(3908):atandroid.widget.L

android - ClassCastException : android. 支持.v7.widget.ShareActionProvider

我尝试使用我的操作栏,但我得到了这个执行08-0800:54:08.913:E/AndroidRuntime(18468):FATALEXCEPTION:main08-0800:54:08.913:E/AndroidRuntime(18468):java.lang.ClassCastException:android.support.v7.widget.ShareActionProvidercannotbecasttoandroid.view.ActionProvider08-0800:54:08.913:E/AndroidRuntime(18468):atandroid.view.M

绑定(bind)到服务时出现 Android ClassCast 异常

好的,我是android开发的新手,我正在尝试绑定(bind)到服务,以便在服务启动后我可以调用该服务的方法。下面描述的Activity和Service都是同一个应用程序的一部分,因此应该没有任何问题,但每次我运行我的应用程序时,我都会收到以下错误:java.lang.ClassCastException:android.os.BinderProxy发生这种情况的行是:LocalBinderbinder=(LocalBinder)service;我的Activity代码(简化为):publicclassMainextendsActivity{booleangpsBound=false;

android - java.lang.ClassCastException : android. widget.TextView 无法转换

12-0100:36:28.058:E/AndroidRuntime(5062):Causedby:java.lang.ClassCastException:android.widget.TextViewcannotbecasttoandroid.widget.EditText如果有人知道然后告诉我,我会遇到以上错误......我将非常感激Java:Log.d("Textra",title);Log.d("Dextra",des);EditTextt=(EditText)findViewById(R.id.t);EditTextd=(EditText)findViewById(R.id

android - Java.lang.ClassCastException : Android. support.v7.widget.ContentFrameLayout 无法转换为Android.support.v7.widget.ContentFrameLayout

有时我在安装我的Android应用程序时会遇到以下异常,但这并不总是可重现的。java.lang.ClassCastException:android.support.v7.widget.ContentFrameLayoutcannotbecasttoandroid.support.v7.widget.ContentFrameLayout我在我的Android应用程序上使用multidex,我阅读了thisquestion关于Samsung设备在multidex实现方面存在错误,但这发生在运行5.1的LGG3和运行6.0的HTCA9上。任何人都知道为什么会随机发生这种情况,我该如何解决