Hey guys I got a ListView within a dialog set up however when i set up the onItemSelectedListener in the dialog it does not even register that anything is selected within the ListView in the dialog! Any ideas? here is what i have:
Dialog dialog = new Dialog(DealActivity.this);
dialog.setContentView(R.layout.test_list);
dialog.setTitle("Test Dialog");
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
ListView listView = (ListView) dialog.findViewById(R.id.listView);
//DIDNT INCLUDE CODE HERE THAT SETS UP THE ADAPTER!
//THIS IS WHERE I SET UP THE LISTENER WITHIN THE DIALOG.
listView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent,View arg1, int arg2, long arg3) {
Log.d("clicked","clicked "+ listView.getItemSelectedPosition());
}
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
dialog.show();
}
Try this,
If you have some controls with each item in ListView, like CheckBox, Button,etc, add this to its layout xml.