Is it possible to set the title of an Android Itemin the Java code. I know its possible in the xml file but I want to do it dynamically from within my Java Code. So this was my existing XML file:
 <item
     android:id="@+id/txn">
     android:title="@string/txn">
    <menu>
        <group android:checkableBehavior="single">
            <item
                android:id="@+id/txn_item"
             />
        </group>
    </menu>
</item>
So i want to remove the android:title field and do it direct in Java. So far im trying to do it as follows, but get a NPE:
MenuItem  txn_type_item = (MenuItem) findViewById(R.id.txn);
txn_type_item.setTitle("TESTING!");
Is MenuItem not the right object type here? Or is there something else I am doing wrong?
 
     
    