I am using custom dialog view with recyclerview, and i successfully get data in my recyclerview, but when i m setup click listener to my recyclerview, its not working.
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
pDialog.dismiss();
final AlertDialog.Builder builderSingle = new AlertDialog.Builder(mContext);
final AlertDialog OptionDialog = builderSingle.create();
builderSingle.setTitle("Select Card");
View view = ((Activity)mContext).getLayoutInflater().inflate(R.layout.activity_payment, null);
RecyclerView list1 = (RecyclerView) view.findViewById(R.id.recyclerview);
final LinearLayoutManager mLayoutManager;
mLayoutManager = new LinearLayoutManager(mContext);
list1.setLayoutManager(mLayoutManager);
list1.setItemAnimator(new DefaultItemAnimator());
AdapterDialogCard adapter = new AdapterDialogCard(mContext, list);
list1.setAdapter(adapter);
list1.addOnItemTouchListener(new RecyclerTouchListener(mContext, list1, new RecyclerTouchListener.ClickListener() {
@Override
public void onClick(View view, int position) {
CreditCard item = list.get(position);
cardid = item.getId();
OptionDialog.dismiss();
}
@Override
public void onLongClick(View view, int position) {
}
}));
builderSingle.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builderSingle.setView(view);
builderSingle.show();
}
}
and this is what i got as a result.
so my question is how to set click listener in alert dialog.