java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.TextView

前端 未结 3 1979
囚心锁ツ
囚心锁ツ 2020-12-20 03:26

I\'ve this error when I use my application :

05-01 14:18:41.000: E/AndroidRuntime(26607): FATAL EXCEPTION: main
05-01 14:18:41.000: E/AndroidRuntime(26607):          


        
3条回答
  •  庸人自扰
    2020-12-20 04:18

    Use

     TextView textview=((LinearLayout)view).findViewById(R.id.textView1);
     String info = textView.getText().toString(); 
    

    The xml layout file you have provided is not needed here. The list view row file is culprit .so use Id of Textview that is mentioned in row.xml .

提交回复
热议问题