I have a custom dialog view having a list view in its content.
I have set a onItemClickListener on the list but its not working...
Can anyone have any idea on this, please help.
here is my code.
dialog = new Dialog(context);
customDialogAdapter = new CustomDialogListAdapter(context,PaymentInfo.creditCardTypes);
dialog.setContentView(R.layout.custom_dialog);
list = (ListView) dialog.findViewById(R.id.custom_list);
list.setAdapter(customDialogAdapter);
// Recognizing custom layout parameters.
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void 开发者_C百科onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
System.out.println("Clicked on list...!");
tv = (TextView) arg1.findViewById(R.id.text);
radio = (RadioButton) arg1.findViewById(R.id.radio);
radio.setChecked(true);
System.out.println("You Clicked on "+tv.getText().toString());
dialog.dismiss();
}
});
shap shot.
Thanks in advance...!
sorry for not answering or giving a solution to your problem. But I have a suggestion, why don't you create an Activity (or ListActivity) with Dialog theme? That way you can have all the flexibilities of an Activity and not be constrained with creating a list in a Dialog.
I found a solution to my problem..
That i am setting a listener in adapter which is giving me the list view.
Now its Working. :)
精彩评论