diff --git a/AndroidManifest.xml b/AndroidManifest.xml index c9c41931..474342fa 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -20,7 +20,7 @@ - + diff --git a/src/me/guillaumin/android/osmtracker/activity/DisplayTrackMap.java b/src/me/guillaumin/android/osmtracker/activity/DisplayTrackMap.java index 56ab06ce..e112e736 100644 --- a/src/me/guillaumin/android/osmtracker/activity/DisplayTrackMap.java +++ b/src/me/guillaumin/android/osmtracker/activity/DisplayTrackMap.java @@ -293,8 +293,9 @@ public boolean onOptionsItemSelected(MenuItem item) { } break; case R.id.displaytrackmap_menu_settings: - // Start settings activity - startActivity(new Intent(this, Preferences.class)); + Intent intent = new Intent(); + intent.setClass(DisplayTrackMap.this, SetPreferenceActivity.class); + startActivityForResult(intent, 0); break; } return super.onOptionsItemSelected(item); diff --git a/src/me/guillaumin/android/osmtracker/activity/Preferences.java b/src/me/guillaumin/android/osmtracker/activity/Preferences.java index 76030ea3..95a5c205 100644 --- a/src/me/guillaumin/android/osmtracker/activity/Preferences.java +++ b/src/me/guillaumin/android/osmtracker/activity/Preferences.java @@ -15,7 +15,7 @@ import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceClickListener; -import android.preference.PreferenceActivity; +import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.provider.Settings; @@ -25,7 +25,7 @@ * @author Nicolas Guillaumin * */ -public class Preferences extends PreferenceActivity { +public class Preferences extends PreferenceFragment { @SuppressWarnings("unused") private static final String TAG = Preferences.class.getSimpleName(); @@ -41,13 +41,13 @@ public class Preferences extends PreferenceActivity { private static final String LAYOUT_FILE_EXTENSION = ".xml"; @Override - protected void onCreate(Bundle savedInstanceState) { + public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); // Set summary of some preferences to their actual values // and register a change listener to set again the summary in case of change - final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); // External storage directory EditTextPreference storageDirPref = (EditTextPreference) findPreference(OSMTracker.Preferences.KEY_STORAGE_DIR); diff --git a/src/me/guillaumin/android/osmtracker/activity/SetPreferenceActivity.java b/src/me/guillaumin/android/osmtracker/activity/SetPreferenceActivity.java new file mode 100644 index 00000000..c9d533cf --- /dev/null +++ b/src/me/guillaumin/android/osmtracker/activity/SetPreferenceActivity.java @@ -0,0 +1,17 @@ +package me.guillaumin.android.osmtracker.activity; + +import android.app.Activity; +import android.os.Bundle; + +public class SetPreferenceActivity extends Activity{ + + @Override + protected void onCreate(Bundle savedInstanceState) { + // TODO Auto-generated method stub + super.onCreate(savedInstanceState); + + getFragmentManager().beginTransaction().replace(android.R.id.content, + new Preferences()).commit(); + } + +} diff --git a/src/me/guillaumin/android/osmtracker/activity/TrackLogger.java b/src/me/guillaumin/android/osmtracker/activity/TrackLogger.java index bdb218ab..73353c0d 100644 --- a/src/me/guillaumin/android/osmtracker/activity/TrackLogger.java +++ b/src/me/guillaumin/android/osmtracker/activity/TrackLogger.java @@ -21,7 +21,6 @@ import android.content.Intent; import android.content.ServiceConnection; import android.content.SharedPreferences; -import android.content.SharedPreferences.Editor; import android.content.pm.ActivityInfo; import android.location.LocationManager; import android.net.Uri; @@ -336,8 +335,9 @@ public boolean onOptionsItemSelected(MenuItem item) { } break; case R.id.tracklogger_menu_settings: - // Start settings activity - startActivity(new Intent(this, Preferences.class)); + Intent intent = new Intent(); + intent.setClass(TrackLogger.this, SetPreferenceActivity.class); + startActivityForResult(intent, 0); break; case R.id.tracklogger_menu_waypointlist: // Start Waypoint list activity diff --git a/src/me/guillaumin/android/osmtracker/activity/TrackManager.java b/src/me/guillaumin/android/osmtracker/activity/TrackManager.java index 09258fbe..a156c05d 100644 --- a/src/me/guillaumin/android/osmtracker/activity/TrackManager.java +++ b/src/me/guillaumin/android/osmtracker/activity/TrackManager.java @@ -251,8 +251,9 @@ public void onClick(DialogInterface dialog, int which) { }).create().show(); break; case R.id.trackmgr_menu_settings: - // Start settings activity - startActivity(new Intent(this, Preferences.class)); + Intent intent = new Intent(); + intent.setClass(TrackManager.this, SetPreferenceActivity.class); + startActivityForResult(intent, 0); break; case R.id.trackmgr_menu_about: // Start About activity