Android context menu from the watch list

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 list for each tab. Each tab has its own java file. I'm currently trying to add a context menu that when I click (not long press) on an item in my list will bring up a menu so that I can select an option. Now it just shows a toast displaying the name of the item I clicked. List parameters are now added to the list through a local line declaration, here is an example 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();
        }
      });
    }

, , - ? , , , ?

+3
1

-, , , switch onItemClick(), . switch(position){ //cases and such

, , , ListView, AlertDialog. . . , DialogInterface onClick, , , .// , alert.show();.

, . , , , .

, . , . .

. , , .

0

Source: https://habr.com/ru/post/1754451/


All Articles