Hi there,

I'm have written a preference activity for my application, where I
want to allow the user to currently set a timeout value for GPS.

In my XML I have this in array.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="list_gps_timeout">
        <item value="20000">20 Seconds</item>
        <item value="30000">30 Seconds</item>
        <item value="60000">60 Seconds</item>
    </string-array>
</resources>

And in the layout file, I have this:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/
android">

<ListPreference
        android:entryValues="@array/list_gps_timeout"
        android:entries="@array/list_gps_timeout"
        android:title="GPS Timeout"
        android:summary="The time that the GPS stops searching and falls back
to the last know position."
        android:key="gps_timeout"
        android:defaultValue="20000">
</ListPreference>
</PreferenceScreen>

After setting the value, I then do this within my activity:

app_preferences = PreferenceManager.getDefaultSharedPreferences(this);
GPS_TIMEOUT = app_preferences.getInt("gps_timeout",
DEFAULT_GPS_TIMEOUT);

However, what is returned is "20 Seconds" rather than the value 20000
as an integer.  Can anyone see where I am going wrong?

Regards,
Tane
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to