[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. Using OpenIntents SensorSimulator

Hi,

I want to write a program that can respond to events sensed by
accelerometer. I have the openIntents.jar in my classpath. Also, I
have a simple activity, onCreate() of which has the following lines of
code:

/////////////////////////////////////

mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
Hardware.mContentResolver = getContentResolver();
mSensorManager = (SensorManager) new SensorManagerSimulator(
                                
(SensorManager)getSystemService(SENSOR_SERVICE));


mSensorManager.unregisterListener(this);
SensorManagerSimulator.connectSimulator();

mSensorManager.registerListener(this,
                        SensorManager.SENSOR_ACCELEROMETER ,
                        SensorManager.SENSOR_DELAY_UI);

/////////////////////////////////////

The activity implements the SensorListener Interface and the
onSensorChanged event is coded as follows:

public void onSensorChanged(int sensor, float[] values) {

Log.d("MSG","Acceleromoter detected");
}

When, I run my application and check logcat, i see Log.d() messages
written continuously even when i am not simulating any movements of
the device using the openIntents simulator. the javadoc for
onSensorChanged() reads:
"Called when sensor values have changed. The length and contents of
the values array vary depending on which sensor is being
monitored...."

Is this behavior normal? Am i missing something?




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

2. "Unable to look up android.git.kernel.org (port 9418) (Name or service not known)" during sync up

Hi all,

I am not able to sync up because of the following error. Does anyone
else is also getting the below errors now(this error was not there
ysterday when i started sync up. but it came during sync up process.
And now its coming even before the sync starts.)

Initializing project platform/external/strace ...
fatal: Unable to look up android.git.kernel.org (port 9418) (Name or
service not known)
error: Cannot fetch platform/external/strace


mad...@madhav-laptop:~/mydroid$
mad...@madhav-laptop:~/mydroid$ repo sync
fatal: Unable to look up android.git.kernel.org (port 9418) (Name or
service not known)
error: Cannot fetch repo

mad...@madhav-laptop:~/mydroid$ repo sync
fatal: Unable to look up android.git.kernel.org (port 9418) (Name or
service not known)
error: Cannot fetch platform/external/jhead

Thank you
Regards
Madhav

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

3. TextView - line break

4. Import java.microedition.*... A solution please...

5. market upload issues

6. Google Docs, again

7. How get multiple phone number which are associated with a single contact.