Spinner widget setposition

by Federico Paolinelli » Tue, 25 Aug 2009 01:05:40 GMT


Sponsored Links
 Hi all,
I am having some problems using a spinner with a SimpleCursorAdapter.
Basically, my activity ships a button to start a new activity that add
new items to the table the spinner is linked to.
Everything works beautifully, but the problems started when I wanted
to set the spinner to the last created item. I thought that returing
the rowid of the new item would have been ok, but the code

if(resultCode == Activity.RESULT_OK){
        Long rowid = data.getLongExtra(mDbHelper.ST_ROW_ID, -1);
        if(rowid != -1){
                mSpinner.setSelection(rowid.intValue());
        }
        return;
}

has no effect on the spinner. I also tried to force manually to some
value the argument of setSelection, with no results. Moreover, I am
not sure setSelection would be the right method, since it accepts a
position and not an id.

Any  hints?
Thanks in advance and best regards,
         Federico

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Gallery3D Froyo Stable

buat yg sdh nyoba froyo di spica, hjar bleh...

http://forum.samdroid.net/f9/gallery3d-froyo-stable-1413/

-- 
"Indonesian Android Community [id-android]" 

2. Rejoice EVO Users, CM6 is coming your way!

waaaah asyiiiiik!! hahahaha thanks infonya bro alex, wah sama niy saya
gi di rs juga cek darah, kayaknya sih gejala tipus/db :(




-- 
"Indonesian Android Community [id-android]" 

3. Trying to compile the Voice Dialer, need help...

4. Layout Params classcastexception

5. Protect the Shared Data between service and thread

6. Apps2SD Ev

7. feed utk liat kondisi stock (saham) & valas