Android Open Source - surveygcp Settings Activity






From Project

Back to project page surveygcp.

License

The source code is released under:

GNU General Public License

If you think the Android project surveygcp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.droidplanner.gcp.activitys;
//from  w ww  . ja v  a  2  s .  com
import org.droidplanner.gcp.R;

import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;

public class SettingsActivity extends PreferenceActivity implements
    OnSharedPreferenceChangeListener {
  @SuppressWarnings("deprecation")
  // TODO use more up-to-date code
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);
    SharedPreferences sharedPref = PreferenceManager
        .getDefaultSharedPreferences(this);
    findPreference("pref_map_type").setSummary(
        sharedPref.getString("pref_map_type", ""));

    try {
      EditTextPreference versionPref = (EditTextPreference) findPreference("pref_version");
      String version = getPackageManager().getPackageInfo(
          getPackageName(), 0).versionName;
      versionPref.setSummary(version);
    } catch (NameNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }

  @SuppressWarnings("deprecation")
  public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
      String key) {
    if (key.equals("pref_map_type")) {
      findPreference(key)
          .setSummary(sharedPreferences.getString(key, ""));
    }
  }

  @SuppressWarnings("deprecation")
  @Override
  protected void onResume() {
    super.onResume();
    getPreferenceScreen().getSharedPreferences()
        .registerOnSharedPreferenceChangeListener(this);
  }

  @SuppressWarnings("deprecation")
  @Override
  protected void onPause() {
    super.onPause();
    getPreferenceScreen().getSharedPreferences()
        .unregisterOnSharedPreferenceChangeListener(this);
  }

}




Java Source Code List

android.UnusedStub.java
org.droidplanner.gcp.GCPApp.java
org.droidplanner.gcp.activitys.GCPActivity.java
org.droidplanner.gcp.activitys.SettingsActivity.java
org.droidplanner.gcp.dialogs.openfile.OpenFileDialog.java
org.droidplanner.gcp.dialogs.openfile.OpenGcpFileDialog.java
org.droidplanner.gcp.file.DirectoryPath.java
org.droidplanner.gcp.file.FileList.java
org.droidplanner.gcp.file.IO.GcpReader.java
org.droidplanner.gcp.fragments.GcpMapFragment.java
org.droidplanner.gcp.fragments.helpers.OfflineMapFragment.java
org.droidplanner.gcp.fragments.markers.GcpMarker.java
org.droidplanner.gcp.fragments.markers.MarkerManager.java
org.droidplanner.gcp.gcp.Gcp.java
org.droidplanner.gcp.helpers.LocalMapTileProvider.java
org.droidplanner.gcp.helpers.TTS.java