Action Bar item Not responding on First click
<p>I'm having a strange problem in my action bar there is a share button, But its not working when it is first clicked when the app launches but after first it works without any problem. Here is my Code.</p>

<pre><code> @Override
     public boolean onOptionsItemSelected(MenuItem item) {
     int id = item.getItemId();
     switch (id){
        case R.id.action_settings:
        item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
               final Dialog dialog = new Dialog(MainActivity.this);
                dialog.setContentView(R.layout.about_us);
                dialog.setTitle("About Us");
                dialog.setCancelable(true);
                TextView textView = (TextView)dialog.findViewById(R.id.aboutus);
                textView.setText("blah blah blah");
                Button button = (Button)dialog.findViewById(R.id.close);
                button.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialog.cancel();
                    }
                });
                dialog.show();

                return false;
            }
        });
            break;
        case R.id.share_action: item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                Intent localIntent = new Intent("android.intent.action.SEND");
                localIntent.setType("text/plain");
                localIntent.putExtra("android.intent.extra.TEXT", "blah blah blah");
                localIntent.putExtra("android.intent.extra.SUBJECT", "FLAMES");
                startActivity(Intent.createChooser(localIntent, "Share"));
                return false;
            }
        });
            break;


}
return false;}
</code></pre>

<p>Here is Screenshot.<a href="http://i.stack.imgur.com/Jk3H8.png" rel="nofollow">App Screenshot</a></p>

<p>And i forgot both the Action Bar Menu_items are acting same.
please give any solutions.</p>