package com.example.patrice.preferences;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.preference.PreferenceGroup;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBarActivity;
import android.view.MenuItem;
import android.widget.Toast;

// https://www.javatpoint.com/android-preferences-example

// http://viralpatel.net/blogs/android-preferences-activity-example/

// http://stacktips.com/tutorials/android/starting-an-activity-for-a-result

public class preferences_mode2 extends PreferenceActivity
{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //addPreferencesFromResource(R.xml.preferences_xml);
        //addPreferencesFromResource(R.xml.userpreferences);
        addPreferencesFromResource(R.xml.prefs);
    }

    @Override
    public void onBackPressed()
    {

        Toast.makeText(getApplicationContext(), "Back", Toast.LENGTH_SHORT).show();

        Intent resultIntent = new Intent();
        resultIntent.putExtra("result", "prefs02");
        setResult(RESULT_OK, resultIntent);
        finish();


    }
}


