If you are familiar with the fragment , you can use FragmentDialog , and then in the onCreateDialog method you create a dialog as you wish.
LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.list, null); _list = (ListView) view.findViewById(R.id.listview); _adapter = new AdapterDialog(_context); _list.setAdapter(_adapter); // AlertDialog.Builder builder = new AlertDialog.Builder(_context); builder.setView(view); builder.setTitle("Dialog").setPositiveButton(getActivity().getString(android.R.string.ok), this); return builder.create();
Or something like that Then create a dialog using the singleton method or constructor
_dialog = Dialog.newInstance(R.string.title, this); _dialog.setCancelable(true); _dialog.show(getSupportFragmentManager(), null);
With your aproach you cannot add anything more than “buttons”, if you want to have a custom line in your list, you should use an adapter
hope this helps
source share