2

How to refresh the webview in Android. Inside a webview iframe is there. When i am using NestedScrollView its going to infinite scrolling. even if i am chceking scrolling in y direction value its always giving me as 0 but actually its actual value is not 0.

Layout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/swipeContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <RelativeLayout
        android:id="@+id/nonVideoLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:windowSoftInputMode="adjustResize">

        <WebView
            android:id="@+id/home_activity_webView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:windowSoftInputMode="adjustResize"
            app:layout_constraintDimensionRatio="1" />

    </RelativeLayout>

</android.support.v4.widget.SwipeRefreshLayout>
  • Your Nested Scrollview issue is described in this link https://stackoverflow.com/questions/37775213/adding-pull-to-refresh-on-webview-for-refreshing – Vivek Mishra Aug 28 '18 at 12:28
  • I know the issue and its reason but i want to know how to resolve this. I read many posts but dint find any answer matching my problem. – Akansha Goel Aug 28 '18 at 12:51

1 Answers1

0

When pull down the webView recall the URL in Swipe Refresh method.

      swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {

                //Call your URL again here

            }
        });
Waseem
  • 439
  • 3
  • 18
  • But When to call the swipe refresh .. As my iframe within the webview is at some position other than 0. So its conflicting when i am going up in iframe with the pull down event and its initiating the swipe refresh event. So i want to know how to restrict that conflict between iframe scrolling and refresh event. – Akansha Goel Aug 29 '18 at 05:44