菜单选项按钮无响应

时间:2016-04-14 07:57:52

标签: java android

菜单按钮在此代码中没有响应。但是相同的代码与另一个活动正常工作并给出了response.Update.java代码正常工作。无法确定问题是什么..

ItemAdd.java

/home/gsamaras/CGAL-4.7/examples/Convex_hull_2/convex_hull_yz.cpp:13:83: error: no matching function for call to ‘std::istream_iterator<CGAL::Point_3<CGAL::Epick> >::istream_iterator(const char [19])’
   std::istream_iterator< Point_2 >  input_begin( "convex_hull_yz.cin" );

Update.java`

   public class ItemAdd extends AppCompatActivity implements   View.OnClickListener {


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



    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    //toolbar.setLogo(R.drawable.ic_menu_slideshow);
    setSupportActionBar(toolbar);

      toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_menu_slidesho w));

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intenthome = new Intent(ItemAdd.this,     MainActivity.class);
            startActivity(intenthome);

        }
    });

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.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;
    }
    if(id == R.id.account) {
        Intent intentaccount = new Intent(ItemAdd.this, account.class);
        startActivity(intentaccount);

    }

    if(id==R.id.action_notify) {
        Intent intentNotify = new Intent(ItemAdd.this, Notification.class);
        startActivity(intentNotify);

    }


    return super.onOptionsItemSelected(item);
    }

  }

菜单

public class Update extends AppCompatActivity implements View.OnClickListener{
  @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_update);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    //toolbar.setLogo(R.drawable.ic_menu_slideshow);
    setSupportActionBar(toolbar);

    toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_menu_slideshow));

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intenthome = new Intent(Update.this, MainActivity.class);
            startActivity(intenthome);

        }
    });



}
 @Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.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;
    }
    if(id == R.id.account) {
        Intent intentaccount = new Intent(Update.this, account.class);
        startActivity(intentaccount);

    }

    if(id==R.id.action_notify) {
        Intent intentNotify = new Intent(Update.this, Notification.class);
        startActivity(intentNotify);

    }


    return super.onOptionsItemSelected(item);
}

}

0 个答案:

没有答案