Monday, April 29, 2013

[android help] action bar item onoptionitemselected


I'm using action bar in my application and I want when the user clicks a button, the item in action bar should change text.


This is my code for onOptionsItemSelected()



public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_refresh:
Toast.makeText(this, "Menu Item 1 selected", Toast.LENGTH_SHORT)
.show();
finish();
break;
case R.id.lg:

Toast.makeText(getBaseContext(), "ma", Toast.LENGTH_SHORT).show();
break;

case R.id.French:

Toast.makeText(getBaseContext(), "zaki", Toast.LENGTH_SHORT).show();

break;
case R.id.nerlandais:
Toast.makeText(getBaseContext(), "brahim", Toast.LENGTH_SHORT)
.show();

}

return true;
}


What must I do to add to change the item title from another item.


Example: When I click in French item I want to change nerlandais item title.



.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...