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. Berburu Android di Shanghai

RR,

ada teman yang mau ke Shanghai di bulan Mei, ada yang tau tempat
berburu Android dan asesorisnya yang cukup murah dimana ya?

salam,
Hermanto

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

2. after referring the group锛宼o uch screen can only respond at top bar

Hi,

have you tried to debug EventHub::getEvent in frameworks/bas/libs/ui/
EventHub.cpp? I once had problems with my touchscreen after waking up
from suspend as the device was destroyed and got a new file
descriptor. I finally ended up in debugging this method. It does a
"poll" system call to wait for data on the touchscreen device. You may
want to add some LOGS here to see if it get passed poll when you hit
the ts and see the printk info from the kernel.

Regards,
Achim

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. ikut meratjoeni dengan Android di acara Pesta Wirausaha

4. Emosi Main World War

5. How to send an event to User space?

6. OOT: Komparasi ukuran

7. applying themes to views