Android Open Source - g3m_owm Settings Activity






From Project

Back to project page g3m_owm.

License

The source code is released under:

Copyright (c) 2013, Glob3 Mobile, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...

If you think the Android project g3m_owm 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 com.glob3.mobile.owm;
/*from   w  w w. j  a va  2 s . c  o  m*/
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;


public class SettingsActivity
         extends
            PreferenceActivity
         implements
            OnSharedPreferenceChangeListener {


   @Override
   protected void onPostCreate(final Bundle savedInstanceState) {
      super.onPostCreate(savedInstanceState);

      setupSimplePreferencesScreen();
   }


   @SuppressWarnings("deprecation")
   public void setupSimplePreferencesScreen() {

      // In the simplified UI, fragments are not used at all and we instead
      // use the older PreferenceActivity APIs.

      // Add 'general' preferences.
      addPreferencesFromResource(R.xml.settings);

      PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);


   }


   @Override
   public void onSharedPreferenceChanged(final SharedPreferences sp,
                                         final String st) {
      sp.edit().putString(st, sp.getString(st, "NO VALUE"));
      final AlertDialog.Builder builder = new AlertDialog.Builder(SettingsActivity.this);
      builder.setTitle("Restart Message").setMessage("You need restart the app to apply preferences changes").setCancelable(false).setNegativeButton(
               "Close", new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(final DialogInterface dialog,
                                      final int id) {
                     dialog.cancel();
                     System.exit(0);
                  }
               });
      final AlertDialog alert = builder.create();
      alert.show();
   }


}




Java Source Code List

com.glob3.mobile.owm.DataSourceAdapter.java
com.glob3.mobile.owm.Dialogs.java
com.glob3.mobile.owm.G3MOWMMainActivity.java
com.glob3.mobile.owm.GPSTracker.java
com.glob3.mobile.owm.Prefs.java
com.glob3.mobile.owm.SettingsActivity.java
com.glob3.mobile.owm.shared.G3MOWMBuilder.java
com.glob3.mobile.owm.shared.G3MOWMListener.java
com.glob3.mobile.owm.shared.data.DataRetriever.java
com.glob3.mobile.owm.shared.data.DialogDataListener.java
com.glob3.mobile.owm.shared.data.Place.java
com.glob3.mobile.owm.shared.data.Places.java
com.glob3.mobile.owm.shared.data.SimpleRasterLayerBuilder.java
com.glob3.mobile.owm.shared.data.Utils.java
com.glob3.mobile.owm.shared.data.WeatherForecastParser.java
com.glob3.mobile.owm.shared.data.WeatherForecast.java
com.glob3.mobile.owm.shared.data.Weather.java