I have a quick question. My main class file has this:
Button update = (Button) findViewById(R.id.update);
update.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
EditText status = (EditText) findViewById(R.id.status);
String updtext = status.getText().toString();
SharedPreferences preferences =
getPreferences(MODE_PRIVATE);
String usertext = preferences.getString("user", null);
String passtext = preferences.getString("pass", null);
Twitter twitter = new Twitter(usertext,passtext);
twitter.setSource("twitterit");
twitter.updateStatus(updtext);
status.setText("");
}
});
}
and I am trying to access preferences from this XML file:
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Twitter Credentials">
<EditTextPreference
android:key="user"
android:title="Username"
android:summary="Your Twitter.com username" />
<EditTextPreference
android:key="pass"
android:title="Password"
android:summary="Your Twitter.com password" />
</PreferenceCategory>
</PreferenceScreen>
but for some reason it keeps returning a null string:
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---