
I want to have an Action Bar like foursquare. What I want is tabs such as
To set your custom action items (refresh, check in, ...) you must override onCreateOptionsMenu(Menu menu) and set your custom menu.
e.g:
File menu/my_menu.xml
Then in your activity (or fragment):
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.my_menu, menu);
// Allow activity and fragments to add items
super.onCreateOptionsMenu(menu);
return true;
}
And to be notified when they are selected, just override onOptionsItemSelected(MenuItem item):
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case android.R.id.refresh :
// refresh your data...
return true;
default :
return super.onOptionsItemSelected(item);
}
}