I have an Alert Dialog that has a list on it and I want to close onlistclick, is this possible?
AlertDialog.Builder builder = new AlertDialog.Builder(this); final String[] Categories = SQLiteHelper.getAllCategories();//this is where i get the array for my list ListView myList = new ListView(this); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.alert_dialog_list_view, Categories); myList.setAdapter(adapter); myList.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) { //doing something in here and then close } }); builder.setTitle("Please Choose"); builder.setInverseBackgroundForced(true); builder.setView(myList); final Dialog dialog = builder.create(); dialog.show(); }
The warning dialog works fine, I just don't want to insert any buttons into it.
Stelios m
source share