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
try this one
String[] listItems = {"Colour", "Font Size",};
ListView lv = (ListView) findViewById(R.id.settings_list);
lv.setAdapter(new ArrayAdapter
(this, android.R.layout.simple_list_item_1, listItems));
lv.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView> parent, View
view, int position, long id)
{
String[] listItems = {"Colour", "Font Size",};
if(listItems[position].equals("Font Size"))
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
getApplicationContext());
// set title
alertDialogBuilder.setTitle("Choose Font Size");
//create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}
}
});