Saturday, 3 January 2015

How to Toggle the Bool value in XML in Android



In my android app, I've defined a bool value:



<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="booleanvalue">false</bool>
</resources>


I'm using it to show or hide a menu function in my menu.xml:



<item
android:id="@+id/menu1"
android:icon="@drawable/menu_on"
android:showAsAction="ifRoom"
android:title="@string/show_menu1"
android:visible="@bool/booleanvalue"
/>


However is it possible to get the negative value of the Boolean in the menu.xml without changing the original value?


I want it because there is another menu item which gets hidden when this menu 1 is displayed.


No comments:

Post a Comment