[HELP]How to set Spinner's Default value

by mwang » Sat, 21 Feb 2009 01:49:24 GMT


Sponsored Links
 I initialize a spinner with an ArrayAdapter<String>, then save the
choosed value into database.
Next, when I query the value (USD) from database, I don't how to set
"USD" into Spinner as default value.

It always display "RMB" as default value now, I don't kown there is
any API which i could change it with "USD".

E.g.
private static final String sCurrencyType[] = { "RMB", "USD",  "JPY",
"EUR","CAD", "AUD", GBP" };

Set Adapter

        ArrayAdapter<String> adapter;
        adapter = new ArrayAdapter<String>(this,
                                android.R.layout.simple_spinner_item, 
sCurrencyType);
        adapter.setDropDownViewResource
(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter)

Is there anyone who have the same question like mine?

Thanks in advance.

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



Other Threads

1. The difference between "Runtime.getRuntime().freeMemory();" and "ActivityManager.MemoryInf.availMem"

The first is about the the VM in the local process, the second is a
rough measure of the memory situation in the overall system:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#freeMemory()

http://code.google.com/android/reference/android/app/ActivityManager.MemoryInfo.html#availMem



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

2. my question...

Hi,
I'm looking for a code that can replace the following code since its no more 
existing:

 /** This function actually handles the KeyStroke-Injection. */ 
 private void doInjectKeyEvent(KeyEvent kEvent) { 
 try { 
 /* Inject the KeyEvent to the Window-Manager. */ 
 windowManager.injectKeyEvent(kEvent.isDown(), 
kEvent.getKeyCode(), 
 kEvent.getRepeatCount(), kEvent.getDownTime(), kEvent 
 .getEventTime(), true); 
 } catch (DeadObjectException e) { 
 e.printStackTrace(); 
 } 
 } 

if u have a pieces of code that doing so I'll be glad to get it....
10x
Yorgen



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

3. Any shared memory and named semaphores in Android

4. GoogleMaps-Logo on MapView hidden - Maps ToS - Advocate Question

5. J2ME apps for Android --J2ME MIDP RUNNER

6. Jythonroid: Jython runs successfully on Android Emulator

7. The difference between "Runtime.getRuntime().freeMemory();" and "ActivityManager.MemoryInf.availMem"