[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. Question about GoogleSearch.apk and "android.process.acore"

Hi all,

I want to test which packages(packages/apps/) are necessary to run
Android on the emulator. I just try to remove GoogleSearch.apk, but
the emulator shows "The process android.process.acore has stopped
unexpectedly. Please try again."
I look at the AndroidManifest.xml file and see
"<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.android.googlesearch"
  android:sharedUserId="android.uid.shared">
<application
  android:process="android.process.acore""

It seems this process is not started by GoogleSearch.apk. I see from
the Dev Guide that
"By default, Android creates a process for an application when the
first of its components needs to run. All components then run in that
process. The name of the default process matches the package name set
by the <manifest> element."

So, I wonder who starts this process and why this process stops only
due to GoogleSearch.apk?

Thanks for your help.

Best wishes,
Caixia

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

2. Adding Components Programmatically

Hi,

  I am new to Android development. I have been searching google to add
multiple components to a View programmatically .i.e add TextField,
Button, etc one below the other.


I could only find examples where they have used XML to design the UI.
If i want to add the components programmatically how can I do that or
I will have design the UI only using the XML.



Thanks,

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

3. Unable to add Android Plugin to Eclipse-Ganymede 3.4.1

4. ADT Eclipse Plugin: Can't install - "No Repository Found"

5. Multiple Framebuffer devices(dynamically change) support for Surfaceflinger.

6. How to use the sample projects

7. FILL_AND_STROKE does not seem to work with rectangles!