The standard Cube2 Live Wallpaper demo seems to handle Preferences
strangely to me, in that it wires up an event handler which modifies a
global variable. I don't want to to do that (or, more to the point,
when I tried it didn't work for me).
I don't see that I need to wire up any event handlers; can't I just
read the preferences directly where I need them?
It seems to me from the documentation/samples is that the *only* thing
I have to do is add the lines:
String PREF_FILE_NAME = "cube2_settings";
SharedPreferences preferences = getSharedPreferences(PREF_FILE_NAME,
MODE_PRIVATE);
String teststring = preferences.getString("cube2_shape", "cube");
anywhere in the animation loop, and teststring should be either a
"cube" or a "dodecahedron" depending on the preference. It is always a
cube.
cube2_settings.xml is the standard one:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/
android"
android:title="@string/cube2_settings"
android:key="cube2wallpaper_settings">
<ListPreference
android:key="cube2_shape"
android:title="@string/cube2_settings_title"
android:summary="@string/cube2_settings_summary"
android:entries="@array/cube2_shapenames"
android:entryValues="@array/cube2_shapeprefix" />
</PreferenceScreen>
If nothing else, the Cube demo doesn't show how to gain access to
preferences from within its animation loop (that I can see), for the
record can anybody tell me what I (and the cube demo) are missing to
allow that?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en