由于我在第二个Activity中指定了进程名字,但是服务却没有指定进程名(默认跟主入口一个进程)所以报错. 网上找到的是 服务 和绑定服务的客户端必须在同一个application或者进程中,所以Manifest中也要指定服务的进程名且和调用服务的Activity的中客户端在同一进程中. <service android:name=".TestService" android:process="myprocess.remote"/><activit…
最近在学习drawerLayout时,遇到这个bug.如下示: java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView 原因: 可能是没有在适配器参数内加入TextView的id. 解决方案: 将原来的适配器参数代码 mDrawerList.setAdapter(new ArrayAdapter<String>(this,R.layout.list…
Caused by: Java.lang.ClassCastException: Android.widget.TextView cannot be cast to android.widget.EditText 该种报错信息,检查代码确定无误后,若还是出现这种错误,则可通过以下这个办法进行解决: 点中该项目-->点击Project-->clean   清理下再重新运行该项目…
Caused by: Java.lang.ClassCastException: Android.widget.TextView cannot be cast to android.widget.EditText 该种报错信息,检查代码确定无误后,若还是出现这种错误,则可通过以下这个办法进行解决: 点中该项目-->点击Project-->clean   清理下再重新运行该项目,然后就解决了…
今天遇到一个错误也不知道怎么回事,上网搜了一下: 出现的问题是:java.lang.ClassCastException:android.widget.Button cannot be cast to android.widget.ImageView 解决的方法是: Clean 你的项目.(点击eclipse上面的project然后clean然后选择你要clean的项目) 修改一个xml文件,然后保存(稍微动一下,保存) 删除 R 文件. (build project 之后会自动生成).…
出这个异常的原因是在项目中添加了新lication类(public class Application extends lication)之后,没有在AndroidManifest.xml中添加该类的声明,所以编译器抛出异常: java.lang.ClassCastException: android.app.Application cannot be cast to 类名  <application android:icon="@drawable/icon" android:l…
有时在修改xml文件时,全报这种错误,这个应该是缓存没得到及时更新导致的,可以通过以下方法解决: Eclipse tends to mess up your resources every now and then. This leads to some odd behavior such as strings and images being swapped all over your app, and more commonly classCastException(s), which ha…
09-09 10:19:59.979: E/AndroidRuntime(2767): FATAL EXCEPTION: main09-09 10:19:59.979: E/AndroidRuntime(2767): java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams09-09 10:19:59.97…
RelativeLayout title_bg = (RelativeLayout)FTU_Bluetooth.this.findViewById(R.id.titlebar); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 0x55); title_bg.setLayoutParams(params); 如果用RelativeLayout.LayoutPara…
java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.ProgressBar$SavedState 这个问题折腾了老半天,后来才发现是因为不同布局文件中有重名的控件,而且在要显示的Activity中同时用到了这些布局,所以导致这个问题.…