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. Accessing Resources in a ProviderTestCase2

I'm writing tests to exercise my database using ProviderTestCase2.

Within my application, as part of the onCreate and onUpdate methods in
my SQLiteOpenHelper subclass, several SQL statements are executed.
These statements are stored in my strings.xml resources file.

The issue is that I can't call getResources on the ProviderTestCase2's
mock context because its internal RenamingDelegatingContext only
supports calls to database and file related context methods,
everything else throws an UnsupportedOperationException.

I have solved this by implementing my own RenamingDelegatingContext
that also supports getResources() but given that this is not supported
by default, I was wondering if I have done something that is
considered bad form by storing SQL statements in strings.xml instead
of hard coding them in my SQLiteOpenHelper subclass.

Any comments?

-- 

2. New iPhone 4 camera test reveals impressive pictures and video - GSMArena.com news

well, quite amazing I think :)

http://www.gsmarena.com/new_iphone_4_camera_test_reveals_impressive_pictures_and_video-news-1753.php

---
This message was sent by eko.m...@gmail.com via http://addthis.com.  Please 
note that AddThis does not verify email addresses.

Make sharing easier with the AddThis Toolbar:  
http://www.addthis.com/go/toolbar-em

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

3. Samsung Galaxy S Live Wallpaper

4. flac player on android

5. ListView Out Of Memory Problem

6. OOT: KMM(kuis malem-malem)

7. Adding client to the framebuffer