android:onClick set on menuitem in xml

PypedeftTeeft

New Member
Dear can we use onclick with menu item in xml. like below .i tried it but its not working.\[code\]<menu xmlns:android="http://schemas.android.com/apk/res/android" ><item android:id="@+id/logout" android:onClick="onLogOut" android:title="@string/logout"></item>\[/code\]Java Code :\[code\]public void onLogOut(MenuItem v) { Utility.LogError(TAG, "onLogOut Clicked"); Toast.makeText(this, "onLogOut", Toast.LENGTH_SHORT).show();}\[/code\]}onLogOut is not get called....
 
Back
Top