android.view.InflateException: Binary XML file line #29: Error inflating class 解決方法




裏面報錯

Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class <unknown>

Caused by: java.lang.reflect.InvocationTargetException

Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()


其實我29行是一個Spinner

<Spinner
            android:id="@+id/number_type"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="2" />

大概操作是  在  AsyncTask 中的 doInBackground  操作界面 出現這個問題


最後在  doInBackground 方法中加入 

Looper.prepare();

Ok了



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章