@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
Toast.makeText(this, "Tapped home", Toast.LENGTH_SHORT).show();
break;
case R.id.menu_refresh:
Toast.makeText(this, "Fake refreshing...", Toast.LENGTH_SHORT).show();
getActionBarHelper().setRefreshActionItemState(true);
getWindow().getDecorView().postDelayed(
new Runnable() {
public void run() {
getActionBarHelper().setRefreshActionItemState(false);
}
}, 1000);
break;
case R.id.menu_search:
Toast.makeText(this, "Tapped search", Toast.LENGTH_SHORT).show();
break;
case R.id.menu_share:
Toast.makeText(this, "Tapped share", Toast.LENGTH_SHORT).show();
break;
}
return super.onOptionsItemSelected(item);
}
沒有留言:
張貼留言