I've created a custom dialog, which has multiple views within it. On click of these Views, I would like to start activities for results, like Camera, Gallery, etc.
CustomDialog
public class CustomDialog extends BottomBaseDialog {
public static LinearLayout ll_camera;
public static LinearLayout ll_gallery;
public CustomDialog(Context context, View animateView) {
super(context, animateView);
}
@Override
public View onCreateView() {
View inflate = View.inflate(context, R.layout.dialog_custom, null);
ll_camera = ViewFindUtils.find(inflate, R.id.camera_linear_layout);
ll_gallery = ViewFindUtils.find(inflate, R.id.gallery_linear_layout);
return inflate;
}
@Override
public boolean setUiBeforShow() {
ll_camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// OPEN INTENT FOR CAMERA
dismiss();
}
});
ll_gallery.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// OPEN INTENT FOR GALLERY
dismiss();
}
});
return false;
}
}
Then within my fragment, I've displayed this dialog by
IOSTaoBaoDialog dialog = new IOSTaoBaoDialog(getActivity(), AddActivity.drawerLayout);
dialog.show();
How can I call onClick for the Camera and Gallery Linear Layout views from within my Fragment? I also need to get the result of the activities back into the fragment, so I can process it. Please suggest.
I've done a lot of search and I came across suggestions to use Interfaces, however, I do not clearly understand how that will work.