Android Studio - Displaying Listing Thought Within Alertdialog

Android Studio - Displaying List View Inside AlertDialog


1.) Follow this code:
================
>Note: custom_dialog_layout.xml is the layout that volition pop-up
>Note: row.xml is the exceptional used for populating row
AlertDialog.Builder  builder = novel AlertDialog.Builder(new ContextThemeWrapper(MainActivity.this, android.R.style.Theme_Holo));  builder.setTitle("Custom Dialog");  View customView = LayoutInflater.from(MainActivity.this).inflate(R.layout.custom_dialog_layout, null, false);  ListView listList1 = (ListView)customView.findViewById(R.id.listView1); String[] stringArray1 = novel String[] { "Bright Mode", "Normal Mode" }; ArrayAdapter adapter1 = novel MyListAdapter(MainActivity.this, R.layout.row, stringArray1); listList1.setAdapter(adapter1);  builder.setView(customView);  builder.setPositiveButton(android.R.string.yes, novel DialogInterface.OnClickListener() {     populace void onClick(DialogInterface dialog, int which) {        //Ok      } });  builder.setNegativeButton(android.R.string.no, novel DialogInterface.OnClickListener() {     populace void onClick(DialogInterface dialog, int which) {         //Cancel     } });  builder.show(); 
Next
Previous
Click here for Comments

0 komentar:

Please comment if there are any that need to be asked.