Spinner not being displayed in TabHost
Hello Friends I want to Display a Spinner in the TabHost Activity.
But when I click on the TabHost it gives me the following exception:
06-12 19:27:55.003: ERROR/AndroidRuntime(922): android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@44dba180 is not valid; is your activity running?
Please tell me how can I display the SPinner with Single Choice menu Item 开发者_StackOverflow社区in TabHost Tabs?
I get that error when working with dialogs, and it's caused by using an invalid context to instantiate your view.
Take a look at the context object you're using to instantiate the spinner and the tabhost. The tabhost should be using the activity's context, and the Spinner should probably be using the tabhost's context.
If you can, post the code where you are instantiating both object.
You must use LocalActivityManager example :
mlam = new LocalActivityManager(this, false);
mlam.dispatchCreate(savedInstanceState);
tabHost.setup(mlam);
加载中,请稍侯......
精彩评论