java.lang.ClassCastException:android.widget.TextView无法施放ClassCastException、lang、java、TextView

由网友(复兴从前)分享简介:12-01 00:36:28.058:E / AndroidRuntime(5062):由:java.lang.ClassCastException:android.widget.TextView不能转换为android.widget。的EditText我收到上述错误,如果有人知道,然后告诉我...我将非常感激。J...

  12-01 00:36:28.058:E / AndroidRuntime(5062):由:java.lang.ClassCastException:android.widget.TextView不能转换为android.widget。的EditText
 

我收到上述错误,如果有人知道,然后告诉我...我将非常感激。

Java的:

  Log.d(Textra称号);
Log.d(Dextra,DES);
的EditText T =(EditText上)findViewById(R.id.t);
EditText上D =(EditText上)findViewById(R.id.des);
t.se​​tText(职称);
d.setText(DES);
 

XML:

 <的LinearLayout
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT>

    <的TextView
        机器人:ID =@ + ID /吨
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:文本=
        机器人:textAppearance =:/>中的Andr​​oid ATTR / textAppearanceLarge?

    <的TextView
        机器人:ID =@ + ID / DES
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:文本=/>

< / LinearLayout中>
 
Java 混淆工具 ProGuard 之初体验

解决方案

删除R.java 清洁工程 保存文件 构建和放大器;运行

12-01 00:36:28.058: E/AndroidRuntime(5062): Caused by: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText

I am getting above error if anyone knows then tell me ...i shall very thankful

Java:

Log.d("Textra", title); 
Log.d("Dextra", des); 
EditText t=(EditText) findViewById(R.id.t); 
EditText d=(EditText) findViewById(R.id.des); 
t.setText(title); 
d.setText(des);

XML:

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

    <TextView 
        android:id="@+id/t" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="" 
        android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <TextView 
        android:id="@+id/des" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text=""/> 

</LinearLayout>

解决方案

Delete R.java Clean project Save files Build & Run

阅读全文

相关推荐

最新文章