Hi,
I'm pretty new to Android dev and still working out a lot of things.
I've got a main menu showing using the following code, but can't work out how to disable selected items in the menu. Can anybody help me with some sample code?
public class listTest extends ListActivity {
@Override
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
setListAdapter(ArrayAdapter.createFromResource(this, R.array.mainMenu,
android.R.layout.simple_list_item_1));
//not sure how to disable list items here
}
protected void onListItemClick(ListView list, View view, int position, long id) {
// can disable items when they are clicked on
view.setEnabled(false);
}
}
and I have a string-array
in my strings.xml file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="mainMenu">
<item>Item 1</item>
<item>Item 2</item>
<item>Item 3</item>
</string-array>
</resources>
Thank you