android使用spinner的错误
当我直接拉spinner来使用的时候,一就算没有加任何编译代码,运行以后,点击了那个spinner,直接出现的错误如下:06-2515:02:16.330:E/Andro...
当我直接拉spinner来使用的时候,一就算没有加任何编译代码,运行以后,点击了那个spinner,直接出现的错误如下:
06-25 15:02:16.330: E/AndroidRuntime(19208): FATAL EXCEPTION: main
06-25 15:02:16.330: E/AndroidRuntime(19208): android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@4111f370 is not valid; is your activity running?
06-25 15:02:16.330: E/AndroidRuntime(19208): at android.view.ViewRootImpl.setView(ViewRootImpl.java:585)
这里是相关代码:
<Spinner android:id="@+id/spinner2" android:layout_width="wrap_content" android:layout_height="45dp" android:layout_marginLeft="20dp" android:layout_marginTop="5dp" android:layout_weight="100" android:background="@drawable/watch_list_title_btn" android:entries="@array/MarketLimit"
android:prompt="@string/MarketLM" />
private void addListenerOnSpinnerItemSelection() {
spinner3 = (Spinner) findViewById(R.id.spinner3);
spinner3.setOnItemSelectedListener(new CustomOnItemSelectedListener());
} 展开
06-25 15:02:16.330: E/AndroidRuntime(19208): FATAL EXCEPTION: main
06-25 15:02:16.330: E/AndroidRuntime(19208): android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@4111f370 is not valid; is your activity running?
06-25 15:02:16.330: E/AndroidRuntime(19208): at android.view.ViewRootImpl.setView(ViewRootImpl.java:585)
这里是相关代码:
<Spinner android:id="@+id/spinner2" android:layout_width="wrap_content" android:layout_height="45dp" android:layout_marginLeft="20dp" android:layout_marginTop="5dp" android:layout_weight="100" android:background="@drawable/watch_list_title_btn" android:entries="@array/MarketLimit"
android:prompt="@string/MarketLM" />
private void addListenerOnSpinnerItemSelection() {
spinner3 = (Spinner) findViewById(R.id.spinner3);
spinner3.setOnItemSelectedListener(new CustomOnItemSelectedListener());
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询