Opening a JAR
android:scrollHorizontally="false"
android:maxLines="5"
android:maxWidth="200sp"
/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Send"
/>
Then, eliminate references to the removed widgets from the list of data
members and from onCreate().
Next, create a private SharedPreferences data member named prefs and set
it up in onCreate():
prefs=PreferenceManager.getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(prefListener);
The aforementioned code references an prefListener object, so define it as
follows:
private SharedPreferences.OnSharedPreferenceChangeListener prefListener=
new SharedPreferences.OnSharedPreferenceChangeListener() {
public void onSharedPreferenceChanged(SharedPreferences sharedPrefs, String
key) {
if (key.equals("user") || key.equals("password")) {
resetClient();
}
}
};
Basically, when the preference changes, we want to reset our Twitter client.
This, of course, assumes we have a Twitter client hanging around, so create
a private Twitter data member named client, and add two methods to work
with it as follows:
synchronized private Twitter getClient() {
if (client==null) {
client=new Twitter(prefs.getString("user", ""),
prefs.getString("password", ""));
client.setAPIRootUrl("https://identi.ca/api");
171
Subscribe to updates at http://commonsware.com
Special Creative Commons BY-NC-SA 3.0 License Edition
android:scrollHorizontally="false"
android:maxLines="5"
android:maxWidth="200sp"
/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Send"
/>
Then, eliminate references to the removed widgets from the list of data
members and from onCreate().
Next, create a private SharedPreferences data member named prefs and set
it up in onCreate():
prefs=PreferenceManager.getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(prefListener);
The aforementioned code references an prefListener object, so define it as
follows:
private SharedPreferences.OnSharedPreferenceChangeListener prefListener=
new SharedPreferences.OnSharedPreferenceChangeListener() {
public void onSharedPreferenceChanged(SharedPreferences sharedPrefs, String
key) {
if (key.equals("user") || key.equals("password")) {
resetClient();
}
}
};
Basically, when the preference changes, we want to reset our Twitter client.
This, of course, assumes we have a Twitter client hanging around, so create
a private Twitter data member named client, and add two methods to work
with it as follows:
synchronized private Twitter getClient() {
if (client==null) {
client=new Twitter(prefs.getString("user", ""),
prefs.getString("password", ""));
client.setAPIRootUrl("https://identi.ca/api");
171
Subscribe to updates at http://commonsware.com
Special Creative Commons BY-NC-SA 3.0 License Edition
