Closed mhemon closed 3 years ago
For androidx.fragment.app.Fragment
, you should be able to replace mWebView.setListener(this, this);
with mWebView.setListener(getActivity(), this);
, as shown in the README, or even mWebView.setListener(getActivity(), getActivity());
.
Does that work?
Found a solution to handle on back press..
OnBackPressedCallback callback = new OnBackPressedCallback(true /* enabled by default */) {
@Override
public void handleOnBackPressed() {
if (!mWebView.onBackPressed()) {
return;
}
remove();
}
};
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
@mhemon the problem is that the library use android.fragment.app.Fragment
and your project probably use androidx.fragment.app.Fragment
so the listener mWebView.setListener(this, this);
cannot works
@ocram please update your library to androidx
@developerGM yes, ur right.
@mhemon will there be an update of this library?
@ocram plz tell us, is there any update Coming up.
// in the androidx Fragment (androidx.fragment.app.Fragment)
mWebView.setListener(this,this);
give error.. and also how to handle OnBackpress in the Fragment? seems you didn't mention that. i was trying to Achive mWebView.canGoBack(); but it's didn't work.
if possible then add a sample app with Fragment in Source Folder in the Master branch.