I am new to android development, and not very good at programming in general but, I am working on a tab layout that has a listview per tab. Each tab has it's own java file. I am currently trying to add a context menu that when clicked (not long clicked) on an item in my listview, will bring up a menu so I can choose an option. Right now it just shows a toast displaying the name of the item I clicked. The listview options are currently added to the list via local string declaration, here is an example of on of my tabs:
public class AlbumTab extends ListActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
final String[] CDExplorer_tabs = new String[] {"Client Heirarchy", "Territory", "Sales Credit", "Admin", "General Search"};
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, CDExplorer_tabs));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view,
int position, long id)
{
Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
Toast.LENGTH_SHORT).show();
}
});
}
would I have to make another string array for each menu I want to popup and somehow connect it to the other string? Or do if statements that decide on which menu to popup based on which listview item is clicked?