I am using map fragment to show the user current location on maps.. and also the spinner at the top bar..Refer below image:
Here all of the view is in the tab activity. Now whenever I clicked on spinner to expand, it crashes the app and shows the error as:
android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@40643d88 is not valid; is your activity running?
Refer the below code for populating spinner with items:
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getParent(),
android.R.layout.simple_spinner_item, cat);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner_cat.setAdapter(dataAdapter);
Please suggest..Please note that these views are in the tabs