Skip to content Skip to sidebar Skip to footer

I Want A Popup Menu When I Click On My Listview Item

my activity which contains listview i have five item in this listview. This is my items in Listview , and this is what i want when i click on my first item in listview , there are

Solution 1:

call this method on Item click

privatevoidopenDialogManager() {

        final CharSequence[] items = {"Male", "Female"};

        newAlertDialog.Builder(mActivity)
                .setTitle("Gender")
                .setSingleChoiceItems(items, 0, newDialogInterface.OnClickListener() {
                    @OverridepublicvoidonClick(DialogInterface dialog, int which) {

                        switch (which) {

                            case0:
                                Utils.showToast(mActivity, "Male");
                                dialog.dismiss();
                                break;

                            case1:
                                Utils.showToast(mActivity, "Female");
                                dialog.dismiss();
                                break;
                        }
                        dialog.dismiss();
                    }
                })
                .setNegativeButton("Cancel", newDialogInterface.OnClickListener() {
                    @OverridepublicvoidonClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                })
                .show();
    }

Solution 2:

This is how i implemented the method and the suggestion also

Post a Comment for "I Want A Popup Menu When I Click On My Listview Item"