Creating a Dialog after an onClick event

后端 未结 4 929
梦如初夏
梦如初夏 2021-01-27 18:26

Hi i am working the first time with dialogs. i want to create a dialog after an item in a listView was clicked:

    String[] listItems = {\"Colour\", \"Font Size         


        
4条回答
  •  梦谈多话
    2021-01-27 18:49

    just use

    public void onItemClick(AdapterView parent, View
                view, int position, long id)
        {
            String[] listItems = {"Colour", "Font Size",};
            if(listItems[position].equals("Font Size"))
            {
    
    
                        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                        builder.setTitle("Choose Font Size").show();
    
    
            }
    
        }
    

提交回复
热议问题