Action bar settings button

This commit is contained in:
Sagi Dayan 2016-07-10 14:23:11 +03:00
parent e7565ce98b
commit c3054ba127

View file

@ -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();