TheFinestArtist / FinestWebView-Android

Beautiful and customizable Android Activity that shows web pages within an app.
https://finestwebview.web.app
2.32k stars 531 forks source link

WebView Close Listener #77

Open zahid--ali opened 8 years ago

zahid--ali commented 8 years ago

How can I add onClose listener in FinestWebView? @TheFinestArtist

oktayayr commented 8 years ago

I'm looking for this feature. @zahid--ali @TheFinestArtist

olgunkaya commented 6 years ago

Same here and I think finally I will end-up with extending the ListenerInterface, Builder and Activity itself for related methods.

olgunkaya commented 6 years ago

Ok I did it.

public class CloseListener extends BroadcastReceiver {

public CloseListener(Context conttext) {
        super();
        this.context = conttext;
        LocalBroadcastManager.getInstance(this.context).registerReceiver(this, new IntentFilter("WEBVIEW_EVENT"));
    }
    @Override
    public void onReceive(Context context, Intent intent) {
        BroadCastManager.Type intentType = (BroadCastManager.Type) intent.getExtras().get("EXTRA_TYPE");
        if(intentType == BroadCastManager.Type.UNREGISTER) {
            //doStuff();
        }
    }
}