I have created a custom bottom sheet android dialogue with the help of this answer by Chintan Khetiya:How to create a Custom Dialog box in android?.
I want to dismiss the dialogue from the button defined in the BottomDialogue's own Activity.Not from Calling activity.
Here is my code in the Calling activity in which i have created my custom BottomSheet_liab instance by click of a button:
openBottomDialogeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
**//Creating the BottomDialogue Instance**`Bottomsheet_liab dialog;
dialog=new Bottomsheet_liab(getActivity());
dialog.getWindow().setBackgroundDrawable(newColorDrawable(Color.TRANSPARENT));`
}
});
Here is my code in the dialogue activity:
public class Bottomsheet_liab extends BottomSheetDialog{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cashflow_bottomsheet);
Button btn=(Button)findViewByID(R.id.btnx);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
**//I want to dismiss this BottomSheetDialogue from here.How can I do this>**
}
});
}