Skip to content
Snippets Groups Projects
Commit 102b510e authored by Rizki Halasan's avatar Rizki Halasan
Browse files

setting menu success

parent 86bb2489
Branches
No related merge requests found
......@@ -24,7 +24,7 @@ public class HomeActivity extends AppCompatActivity
private SharedPreferences mPreferences;
private String sharedPrefFile = "com.example.leo.fitnessdiy";
private final String BACKGROUND_KEY = "background";
private final String LOG_TAG = "MAIN ACTIVITY";
private final String LOG_TAG = "BACKGROUND";
@Override
public void onFragmentInteraction(Uri uri) {
......@@ -52,15 +52,9 @@ public class HomeActivity extends AppCompatActivity
chatButton.setImageResource(R.drawable.chat_icon);
mPreferences = getSharedPreferences(sharedPrefFile, MODE_PRIVATE);
SharedPreferences.Editor preferencesEditor = mPreferences.edit();
preferencesEditor.putInt(BACKGROUND_KEY, R.drawable.green_theme);
preferencesEditor.apply();
// mPreferences = getSharedPreferences(sharedPrefFile, MODE_PRIVATE);
// int background = mPreferences.getInt(BACKGROUND_KEY, R.drawable.green_theme);
// getWindow().getDecorView().setBackground(getResources().getDrawable(R.drawable.green_theme));
// Log.d(LOG_TAG, ""+background);
int background = mPreferences.getInt(BACKGROUND_KEY, R.drawable.green_theme);
getWindow().getDecorView().setBackground(getResources().getDrawable(background));
}
public void openHistory(View view) {
......
......@@ -8,7 +8,7 @@ import android.util.Log;
import android.view.View;
public class SettingActivity extends AppCompatActivity {
private String LOG_TAG = "SETTING ACTIVITY";
private String LOG_TAG = "BACKGROUND";
private String sharedPrefFile = "com.example.leo.fitnessdiy";
private final String BACKGROUND_KEY = "background";
private SharedPreferences mPreferences;
......@@ -26,8 +26,6 @@ public class SettingActivity extends AppCompatActivity {
if(view.getId() == R.id.red_theme){
background = R.drawable.red_theme;
}
Log.d(LOG_TAG, ""+background);
Log.d(LOG_TAG, "tes");
mPreferences = getSharedPreferences(sharedPrefFile, MODE_PRIVATE);
SharedPreferences.Editor preferencesEditor = mPreferences.edit();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment