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. Market Quality Suggestion

Hi,

I have a suggestion to make to Google.

I think (and I know I am not alone thinking this..) that the Quality of the
applications on the market needs to improve. Or rather, the low quality
applications needs to be filtered out.

The Big Fruit has solved this by an approval process. While this has proven
to be a good solution to increase the quality of all applications, it is
also a system that prevent many good apps from reaching an audience.

A middle ground that Google could adopt is to have a group that does
approvals on apps just like The Big Fruit, which let's apps into a special
category. Apps that have not yet been approved could however still exist,
but in the unapproved category. This "unapproved" category could work just
like the current market and thus enable the current breadth of applications,
but the "approved" category would enable people to find better apps faster,
and feel safer about the intentions of the application.

To improve first impressions phones should default to only show "Approved"
apps, but enabling non-approved apps should be easily done.

   Best Regards
      Anton

-- 

2. when video duration or date_modified attribute available through content provider

Just to save someone the misery I had to go through. What is required
is a media scan of the SDCARD to make these properties available
through the content provider and android does this when the media is
mounted:

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://" + Environment.getExternalStorageDirectory())));




-- 

3. How to set location information permanently in the emulator

4. track-ball and qwerty keypad..causing error in tabview

5. Flashing your Google I/O Device with a Factory System Image

6. Can't make restartPackage() / killBackgroundProcesses() to work

7. Launch Browser in maximised/minimised mode