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. Cordinates provided by geo fix command to emulator are different in location listener

Hello,
I use Android emulator to test my location based application. The
cordinates are provided by geo fix command (for example: geo fix
2.31278 48.9533 10). But when the new location event is fired, the
cordinates are not the same as those in the command: I got latitude =
48.95800053333334, longitude = 2.3033544999999997 (I use
Location.getLatitude() and Location.getLongitude() methods). Does
anyone have an idea of my trouble ?

Thanks

-- 

2. Is Head First Android Book exists?

Hi All,

I am a big fan of Head First Series. so is there any Head First
Android Book exists?
If not please let me know any similar kind of book for a begineer.

Thanks,
Sohan Badaya

-- 

3. Option Menu to choose before loading widget

4. Android Appwidget resolveUri failed on bad bitmap uri

5. Closing the Application Window Programatically

6. Options for widget loading

7. Unable to retrieve the GIVEN_NAME or FAMILY_NAME from database