commit
832b08043a
1 changed files with 9 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.utils;
|
package info.nightscout.utils;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -25,15 +26,17 @@ import info.nightscout.androidaps.R;
|
||||||
/**
|
/**
|
||||||
* Created by mike on 03.07.2016.
|
* Created by mike on 03.07.2016.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ImportExportPrefs {
|
public class ImportExportPrefs {
|
||||||
static File path = new File(Environment.getExternalStorageDirectory().toString());
|
static File path = new File(Environment.getExternalStorageDirectory().toString());
|
||||||
static final File file = new File(path, MainApp.resources.getString(R.string.app_name) + "Preferences");
|
static final File file = new File(path, MainApp.resources.getString(R.string.app_name) + "Preferences");
|
||||||
|
|
||||||
|
|
||||||
//exports shared Preferences
|
//exports shared Preferences
|
||||||
public static void exportSharedPreferences(final Context c) {
|
public static void exportSharedPreferences(final Context c) {
|
||||||
|
|
||||||
new AlertDialog.Builder(c)
|
new AlertDialog.Builder(c)
|
||||||
.setMessage(MainApp.resources.getString(R.string.export_to) + " " + file + "?")
|
.setMessage(MainApp.resources.getString(R.string.export_to) + " " + file + " ?")
|
||||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
@ -48,7 +51,10 @@ public class ImportExportPrefs {
|
||||||
pw.close();
|
pw.close();
|
||||||
fw.close();
|
fw.close();
|
||||||
ToastUtils.showToastInUiThread(c, MainApp.resources.getString(R.string.exported));
|
ToastUtils.showToastInUiThread(c, MainApp.resources.getString(R.string.exported));
|
||||||
} catch (Exception e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
ToastUtils.showToastInUiThread(c, MainApp.resources.getString(R.string.filenotfound) + " " + file);
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +65,7 @@ public class ImportExportPrefs {
|
||||||
|
|
||||||
public static void importSharedPreferences(final Context c) {
|
public static void importSharedPreferences(final Context c) {
|
||||||
new AlertDialog.Builder(c)
|
new AlertDialog.Builder(c)
|
||||||
.setMessage(MainApp.resources.getString(R.string.import_from) + " " + file + "?")
|
.setMessage(MainApp.resources.getString(R.string.import_from) + " " + file + " ?")
|
||||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue