Zeno Zeno - 4 years ago 240
Android Question

Android: Open Spinner from Button

In an Android application, is it possible to open the spinner popup from a button click instead of pressing the actual spinner?

I have tried the following:

Button btnChange = (Button)findViewById(R.id.btnChange);
btnChange.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Spinner mySpinner = (Spinner) findViewById(R.id.sSpinner);
mySpinner.showContextMenu();
}
});

Answer Source

In an Android application, is it possible to open the spinner popup from a button click instead of pressing the actual spinner?

Apparently not. I do not see a method in the SDK that would seem to trigger the popup list.

IMHO, that is a good thing -- whatever you are trying to accomplish can probably be done in some other fashion that will be less confusing to users.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download