How to get my selected data From the BottomSheetDialogFragment in android? -
explanation: using bottomsheetdialogfragment in application.in when click on button lies in fragment bottomsheetdialog show @ bottom of android phone screen.
the purpose create dialog filter list. so, put required filter data dialog , when select data click on apply button dialog dismiss.until working fine. want know how dialog selected data fragment? based on want apply list data.
bottomsheetfragment.java
public class bottomsheetfragment extends bottomsheetdialogfragment implements view.onclicklistener{ view contentview; button btnapply; // public static bottomsheetfragment newinstance(int num){ // bottomsheetfragment dialogfragment = new bottomsheetfragment(); // bundle bundle = new bundle(); // bundle.putint("num", num); // dialogfragment.setarguments(bundle); // return dialogfragment; // } @nonnull @override public dialog oncreatedialog(bundle savedinstancestate) { bottomsheetdialog dialog = (bottomsheetdialog) super.oncreatedialog(savedinstancestate); contentview = getactivity().getlayoutinflater().inflate(r.layout.fragment_bottom_sheet, null); btnapply=(button)contentview.findviewbyid(r.id.btn_apply); btnapply.setonclicklistener(this); dialog.setcontentview(contentview); return dialog; } // @override // public void setupdialog(dialog dialog, int style) { // super.setupdialog(dialog, style); // contentview = view.inflate(getcontext(), r.layout.fragment_bottom_sheet, null); // dialog.setcontentview(contentview); // // btnapply=(button)contentview.findviewbyid(r.id.btn_apply); // btnapply.setonclicklistener(this); // } @override public void onclick(view view) { if(view.getid()==r.id.btn_apply){ // intent intent = new intent(); // intent.putextra("abc", "ok"); // gettargetfragment().onactivityresult(gettargetrequestcode(), activity.result_ok, intent); toast.maketext(getactivity(), "apply button clicked!!", toast.length_short).show(); } } }
for more see cricbuzz android application , click on bell icon. want this.
Comments
Post a Comment