PreferenceActivity Nullpoint Error

by Radzell » Thu, 19 Nov 2009 16:08:58 GMT


Sponsored Links
  keep getting a nullpoint error from my preferenceactivity i have no
idea whats wrong. I debug and the saveInstancestate is coming in null
for some reason, but it may be something else.

public class SettingsFrontEnd extends PreferenceActivity {
public static final String NO_SELECTION = "0&#8243";

public static final String PASSWORD_KEY = "PASSWORDKEY";
public static final String SELECTED_TARGET_KEY =
"SelectedTargetKey";
public final String QUICK_CONTACT_KEY = "QUICK_CONTACT_KEY";

private android.content.SharedPreferences.Editor editor;
private HelpiDB mDbHelper;

private EditTextPreference passwordPreference;

private SharedPreferences pref;

private CheckBoxPreference quickcontactPreference;
private ListPreference targets;

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);

return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.settings_menu:

break;
case R.id.contact_menu:
if (targets.getValue().equals(NO_SELECTION)) {
Toast.makeText(this, "Choose a Main COntact",
Toast.LENGTH_LONG).show
();
} else {
Intent myIntent = new Intent(SettingsFrontEnd.this,
ContactFrontEnd.class);
startActivityForResult(myIntent, 0);
}
break;
case R.id.map_menu:
if (targets.getValue().equals(NO_SELECTION)) {
Toast.makeText(this, "Choose a Main COntact",
Toast.LENGTH_LONG).show
();
} else {
Intent myIntent = new Intent(SettingsFrontEnd.this,
ContactFrontEnd.class);
startActivityForResult(myIntent, 0);
}
break;
case R.id.insert_menu:
if (targets.getValue().equals(NO_SELECTION)) {
Toast.makeText(this, "Choose a Main COntact",
Toast.LENGTH_LONG).show
();
} else {
Intent myIntent = new Intent(SettingsFrontEnd.this,
InsertFrontEnd.class);
startActivityForResult(myIntent, 0);
}
break;

default:
// put your code here
}
return false;
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setPreferenceScreen(createPreferenceHierarchy());

pref
.registerOnSharedPreferenceChangeListener(new
SharedPreferences.OnSharedPreferenceChangeListener() {

@Override
public void onSharedPreferenceChanged(SharedPreferences
sharedPreferences,
String key) {
if (key.equals(SELECTED_TARGET_KEY)) {
editor = pref.edit();
editor.putString(key, targets.getValue());
}
if (key.equals(PASSWORD_KEY)) {
editor = pref.edit();
editor.putString(key, passwordPreference.getText());
}
if (key.equals(QUICK_CONTACT_KEY)) {
editor



Other Threads

1. HELP : HTC DREAM G1 STUCK!

Permisi,numpang panik.. :)

Semalam setelah liat CM05t5 dan kerasa ngelag rencana mau diturunkan
ke SuperD lagi atau CM4.Saya flash langsung koq selalu stuck di logo T
mob yah?
Saya pake amonra yg masih 1.5.apa harus diupgred ke 1.7 baru bisa
bebas naik turun rom?

Thks,

-- 
"Indonesian Android Community [id-android]" 

2. Notif bar ganti

keren tuh, diapain bisa kaya gitu ya?
udah coba restart masih kaya gitu ngga?
alternatif lain, kalau masih ada backupnya nandroid, bisa coba restore dari
backup terakhir itu dulu, masih kaya gitu ngga?

Thanks,
Ferry L

On Tue, May 25, 2010 at 7:44 PM, senyan dwiseptyoga <beruangsen...@gmail.com




-- 
"Indonesian Android Community [id-android]" 

3. APK Dolphin Browser H

4. Finger swipe in Android API level 3 (OS 1.5) ?

5. astro 2.4.0

6. Problem getting a linearlayout to be scrollable

7. Finger swipe in Android API level 3 (OS 1.5) ?