From c3054ba1271f104a3839f90836ac95d114c44a60 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Sun, 10 Jul 2016 14:23:11 +0300 Subject: [PATCH] Action bar settings button --- .../matan/ara/sagi/thesocialnotework/MainActivity.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MainActivity.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MainActivity.java index fee6bd3..4f7952c 100644 --- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MainActivity.java +++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MainActivity.java @@ -136,8 +136,14 @@ public class MainActivity extends AppCompatActivity // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); + Log.d(TAG, "onOptionsItemSelected: id -> "+id); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + toolbar.setTitle("Settings"); + setSupportActionBar(toolbar); + ft.replace(R.id.fragment_container, settingsFragment); + ft.commit(); return true; } @@ -148,7 +154,6 @@ public class MainActivity extends AppCompatActivity @Override public boolean onNavigationItemSelected(MenuItem item) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - Bundle b = new Bundle(); int id = item.getItemId();