I am facing a problem about spinner. Suppose an spinner dialog is pop up and if in that time locking of screed occur when I unlock the screen the spinner pop up is not shown there. Can anyone suggest me any solution of this or can anyone know how to pragmatically pop up spinner dialog in onResume.
Asked
Active
Viewed 8,739 times
3
-
code is required here which you have did to show spinner popup – Paresh Mayani Apr 06 '12 at 07:14
-
Yes I want to know can you know any way to forcefully show spinner pop up window in program – Farhana Haque Apr 06 '12 at 07:22
2 Answers
18
Try spinner.performClick();
. For me it is working.

Blehi
- 1,990
- 1
- 18
- 20
-
Please also check this thread: http://stackoverflow.com/questions/5555549/android-spinner-performclick-onitemselected – Blehi Apr 06 '12 at 09:12
-
And this: http://stackoverflow.com/questions/2679804/possible-to-programmatically-open-a-spinner-in-android-app – Blehi Apr 06 '12 at 09:13
-
The difference between when it works and when it doesn't is the UI thread. You can only call that method from the UI thread so the onResume would need to set a runonUI in order to invoke. – Tatarize Mar 06 '15 at 18:11
-
When using a dialog my spinner gets open behind the dialog using performClick(); Any solution for this? – Huzaifa Asif Dec 21 '20 at 07:20
0
Try This
Spinner spinner = new Spinner(this);
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, spinnerArray); //selected item will look like a spinner set from XML
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerArrayAdapter);

Pratik Vyas
- 644
- 7
- 20