> > spinner.setOnItemSelectedListener(new OnItemSelectedListener() { > > @Override > public void onItemSelected(AdapterView<?> arg0, View arg1, > int arg2, long arg3) { > // TODO Auto-generated method stub > int selectedPosition = spinner.getSelectedItemPosition(); > > /* > * get the category name in which the reason is selected > into > * the application > */ > } > try it . > it wor perfectly >
This is not what the OP is asking... This will help for getting the selected item once the user has chosen an item. He is asking how to make the spinner show the list of options programatically... Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Thu, Jun 21, 2012 at 7:38 AM, Aashish jawla <aashishja...@gmail.com>wrote: > spinner.setOnItemSelectedListener(new OnItemSelectedListener() { > > @Override > public void onItemSelected(AdapterView<?> arg0, View arg1, > int arg2, long arg3) { > // TODO Auto-generated method stub > int selectedPosition = spinner.getSelectedItemPosition(); > > /* > * get the category name in which the reason is selected > into > * the application > */ > > > > } > > try it . > it wor perfectly > > > On Thu, Jun 21, 2012 at 5:05 PM, vani reddy <vani.reddy.bl...@gmail.com>wrote: > >> >> Hi friends, >> >> How to open spinner on click of a button. >> >> I tried >> Spinner spinner =new Spinner(this); >> ArrayAdapter<String> packSizeAdapter = new ArrayAdapter<String>( >> activity, R.layout.spinner_item, productUOMS); >> >> >> packSizeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); >> spinner .setAdapter(packSizeAdapter); >> >> >> Button btn=new Button(this); >> btn.setOnClickListener(new View.OnClickListener() { >> @Override >> public void onClick(View v) { >> spinner .performClick(); >> } >> }); >> >> It is not working at all ,Is there anyting i am missing..Please reply >> >> -- >> Regards, >> Vani Reddy >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > > > -- > - > Thanks & Regards > Er.Aashish Kumar Jawla > (09555865084/09910783591) > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en