You are probably setting/un-setting the listener somewhere else as well in your code. May be in the on pause method.
*Thanks and Regards, Kumar Bibek* * http://techdroid.kbeanie.com http://www.kbeanie.com* On Tue, Jan 24, 2012 at 7:54 AM, James Black <planiturth...@gmail.com>wrote: > In the onCreate method I define this: > userNameSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { > @Override > public void onItemSelected(AdapterView<?> parentView, > View selectedItemView, int position, long id) { > Log.i(TAG, position); > } > }); > > In onResume and after calling a dialog where a new row can be added to my > list I call this, and it displays the Spinner as I expect when I touch it, > but, the OnItemSelectedListener doesn't appear to be working, as it never > calls the Log method in onItemSelected. I am curious what I did wrong, or > if my order is wrong. > userNameSpinner.setAdapter(new ArrayAdapter<String>(mContext, > android.R.layout.simple_list_item_1, mylist > .toArray(new String[0])) { > @Override > public View getDropDownView(int position, View convertView, > android.view.ViewGroup parent) { > View v = convertView; > if (v == null) { > Context mContext = this.getContext(); > LayoutInflater vi = (LayoutInflater) mContext > .getSystemService(Context.LAYOUT_INFLATER_SERVICE); > v = vi.inflate(R.layout.row, null); > } > TextView tv = (TextView) v.findViewById(R.id.spinnerTarget); > tv.setText(mylist.get(position)); > tv.setTextColor(Color.RED); > return v; > } > }); > > > -- > "I know that you believe you understand what you think I said, but I'm not > sure you realize that what you heard is not what I meant." > - Robert McCloskey > > -- > 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