Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to display an icon on action bar that will navigate to a page.
i have downloaded an icon for it, copied it in drawable folder.

code in menu .xml
Java
<item
        android:id="@+id/action_refresh"
        android:orderInCategory="100"
        android:showAsAction="ifRoom"
        android:icon="@drawable/back"
        android:title="Back"/>/>


code in onOptionItemSelected
Java
if (id == R.id.action_refresh) {
			Intent z=new Intent(getApplicationContext(),HomeScreen.class);
			startActivity(z);
			return true;
		}


on running the app i icon is not shown. where could the mistake be?
Posted
Updated 31-May-15 23:05pm
v2

1 solution

Check this out: https://developer.android.com/training/basics/actionbar/adding-buttons.html[^]
and watch out for any typos and mal-formed xml tags.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900