param position is the item's position in the drop down list, start from 0, not rowid in database
On 8月25日, 上午5时13分, Federico Paolinelli <[email protected]> wrote: > Hi all, I successfully binded aspinnerwidget to a simple cursor > adapter, but I started having problems when I tried to add a new item > to the table which feeds thespinnerby clicking an "add new item" > button. > The idea was to launch a new activity which returns the rowid of the > just added element, and use it to set the new position. > > What I basically did is to implement something like: > > switch(requestCode){ > case CREATE_OBJECT_ACTIVITY:{ > if(resultCode == Activity.RESULT_OK){ > Long rowid = > data.getLongExtra(mDbHelper.ST_ROW_ID, -1); > if(rowid != -1){ > > mSpinner.setSelection(rowid.intValue()); > } > return; > } > > }break; > in the "onActivityResult" method, the rowid has the correct value but > setSelection has no effect. I also tried to force the argument to some > other values, but still with no result. > If I call it in the onCreate method, it works beautifully. > Moreover, I am still not sure that setSelection is the right method to > call, since its arg is named "position" in the doc, while I am passing > an "id". > > Any hint? > > Many thanks in advance, > > Federico --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

