SwipeRefreshLayout to refresh WebView

Suppose you have an app which contains a WebView webview1 inside a LinearV linear1 . In onCreate it loads a website and onBackPressed it goes to previous page. To implement SwipeRefreshLayout in this app to reload the WebView, follow the steps given below. 1. Swith on AppCompat and design. 2. Create a more block extra and put codes to declare a SwipeRefreshLayout srl . Copy code } androidx.swiperefreshlayout.widget.SwipeRefreshLayout srl; { 3. In onCreate event, before loading url in WebView; * define a new SwipeRefreshLayout srl , * remove all views from linear1 , * add SwipeRefreshLayout to linear1 , * add WebView to SwipeRefreshLayout, * setOnRefreshListener for the SwipeRefreshLayout, * In onRefresh event of OnRefreshListener, load WebView getUrl in WebView using blocks. Copy code srl = new androidx.swiperefreshlayout.widget.SwipeRefreshLayout(this); linear1.removeAllViews(); linear1.addView(srl); srl.addView(webview1); srl.setOnRefreshList...