@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle presses on the action bar items
switch (item.getItemId()) {
case R.id.action_settings:
(What i must i write here that app will open another activity?)
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle presses on the action bar items
switch (item.getItemId()) {
case R.id.action_settings:
(What i must i write here that app will open another activity?)
switch (item.getItemId()){
case R.id.action_settings:
Intent i = new Intent(this, AnotherActivity.class);
startActivity(i);
break;
}
Write this to open a new activity-
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
// Handle presses on the action bar items
switch (item.getItemId())
{
case R.id.action_settings:
Intent intent = new Intent(YourCurrentActivity.this, NextActivity.class);
startActivity(intent);