package com.training.toolbarsample1;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;


public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

@@ -162,16 +162,45 @@
 nuItem;%0A
+import android.widget.Toast;%0A
 %0A%0Apublic
@@ -736,330 +736,440 @@
     
-// Handle action bar item clicks here. The action bar will%0A        // automatically handle clicks on the Home/Up button, so long%0A        // as you specify a parent activity in AndroidManifest.xml.%0A        int id = item.getItemId();%0A%0A        //noinspection SimplifiableIfStatement%0A        if (id == R.id.action_settings) %7B%0A
+switch (item.getItemId()) %7B%0A            case R.id.action_about:%0A                Toast.makeText(this, %22About%22, Toast.LENGTH_LONG).show();%0A%0A                return true;%0A%0A            case R.id.action_refresh:%0A                Toast.makeText(this, %22Refresh%22, Toast.LENGTH_LONG).show();%0A%0A                return true;%0A%0A            case R.id.action_settings:%0A                Toast.makeText(this, %22Settings%22, Toast.LENGTH_LONG).show();%0A%0A    
     
@@ -1185,24 +1185,25 @@
 eturn true;%0A
+%0A
         %7D%0A%0A 

fix sample 1