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.setOnRefreshListener( new androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener() {
@Override public void onRefresh() {

// PUT BLOCK TO REFRESH WEBVIEW HERE

}});

4. Add WebView onPageFinished event. Here, to stop the SwipeRefreshLayout, use setRefreshing(false).


Copy code
srl.setRefreshing(false);

5. Save and run the project.

Comments

  1. Need The To Hire A Hacker❓ Then contact PYTHONAX✅

    The really amazing deal about contacting PYTHONAX is that the Hack done by us can’t get traced to you, as every Hacking job we do is strongly protected by our Firewall. It’s like saying if anyone tries to trace the Hack, it will lead them to us and we block whatever actions they are doing.

    We have been Invisible to Authorities for almost a decade now and if you google PYTHONAX, not really about us comes out, you can only see comments made by us or about us.

    Another Amazing thing to you benefit from Hiring our Hackers is that you get a Legit and the best Hacking service, As we provide you with Professional Hackers who have their Hacking Areas of specialization.
    We perform every Hack there is, using special Hacking tools we get from the dark web.

    Some list of Hacking Services we provide are-:
    ▪️Phone Hacking & Cloning ✅
    ▪️Computer Hacking ✅
    ▪️Emails & Social Media Account Hacking✅
    ▪️Recovering Deleted Files✅
    ▪️Tracking & Finding People ✅
    ▪️Hunting Down Scammers✅
    ▪️Hack detecting ✅
    ▪️Stealing/Copying Files & Documents From Restricted Networks and Servers ✅
    ▪️Bitcoin Multiplication✅
    ▪️Binary Option Money Recovery ✅
    ▪️Forex Trading Money Recovery✅
    ▪️IQ Option Money Recovery✅
    And lots more......


    Whatever Hacking service you require, just give us an Email to the Emails Address provided below.
    pythonaxhacks@gmail.com
    pythonaxservices@gmail.com

    PYTHONAX.
    2020 © All Right Reserved.

    ReplyDelete
    Replies
    1. Are you in Need For Hacker Hiring? Then Contact Mills Dachin
      For years now, We've helped organizations secure data base, so many sites USES US AS SECURITY BACK UP TEAM BECAUSE OF OUR METHODS OF HANDLING CYBER MISHAPS.
      ��"CLEAR CRIMINAL RECORDS"
      ��"iPhone HACK"
      ��"BINARY RETRIEVAL" AND LOT MORE BEEN DONE IN SHORT TIMING! 100%✓guarrantee

      * iOS/windows/Android Phone Hacking
      * All kind of loans
      *University Grades
      *Iclouds breaching
      *Criminal Records
      *Hacking ATM Cards
      *Binary Recoveries
      *BTC Mining
      * Cyber Scam recovery
      etc...!!!

      All you need do just Email:- *pointekhack@gmail.com
      *hyperhackerone@gmail.com *cyberhackertap@gmail.com
      *phdatabasesolution@gmail.com

      Delete
    2. Internet Of Today is filled with Scam? With Mills Dachin Quality jobs Delivery Assured, We have help Individuals Organization to Secure and to Recover there lost files/Password/ funds etc. We Are Hacker for Hire. I am saying leave your problem & your Worries for us to solve for you 100%✓guarrantee

      * iOS/windows/iPhone/Android Phone Hacking
      * All kind of loans
      *University Grades
      *Iclouds breaching
      *Criminal Records
      *Hacking ATM Cards
      *Binary Recoveries
      *BTC Mining
      * Cyber Scam recovery
      etc...!!!

      All you need do just Email:- *pointekhack@gmail.com
      *hyperhackerone@gmail.com *cyberhackertap@gmail.com
      *phdatabasesolution@gmail.com

      Delete
  2. Haven't you heard about cyber hacking company blank ATM card and how other people had benefited from it? I am Williams vivian by name, i want to share a blog and forums on how to get real blank ATM card,thank to cyber hacking company who helped me with an already hacked ATM CARD and i was so poor without funds that i got frustrated. One morning as i was browsing on the internet, i saw different comments of people testifying of how cyber hacking company helped him from being poor to a rich man through this already hacked ATM CARD. I was skeptical if this was true, i decided to contact him to know if he is real he proved to me beyond all doubts that its was really for real so i urgently receive my blank ATM card. Contact his email cyberhackingcompany@gmail.com and today am also testifying on how cyber hacking company helped me. I never believed in it until the card was sent to me, which am using today Contact the company now and become rich. Email: cyberhackingcompany@gmail.com  ....

    ReplyDelete
    Replies
    1. Internet Of Today is filled with Scam? With Mills Dachin Quality jobs Delivery Assured, We have help Individuals Organization to Secure and to Recover there lost files/Password/ funds etc. We Are Hacker for Hire. I am saying leave your problem & your Worries for us to solve for you 100%✓guarrantee

      * iOS/windows/iPhone/Android Phone Hacking
      * All kind of loans
      *University Grades
      *Iclouds breaching
      *Criminal Records
      *Hacking ATM Cards
      *Binary Recoveries
      *BTC Mining
      * Cyber Scam recovery
      etc...!!!

      All you need do just Email:- *pointekhack@gmail.com
      *hyperhackerone@gmail.com *cyberhackertap@gmail.com
      *phdatabasesolution@gmail.com

      Delete
  3. Sir. my AppCompat is not working. Please help me....

    ReplyDelete
  4. Hello all
    am looking few years that some guys comes into the market
    they called themselves hacker, carder or spammer they rip the
    peoples with different ways and it’s a badly impact to real hacker
    now situation is that peoples doesn’t believe that real hackers and carder scammer exists.
    Anyone want to make deal with me any type am available but first
    I‘ll show the proof that am real then make a deal like

    Available Services

    ..Wire Bank Transfer all over the world

    ..Western Union Transfer all over the world

    ..Credit Cards (USA, UK, AUS, CAN, NZ)

    ..School Grade upgrade / remove Records

    ..Spamming Tool

    ..keyloggers / rats

    ..Social Media recovery

    .. Teaching Hacking / spamming / carding (1/2 hours course)

    discount for re-seller

    Contact: 24/7

    fixitrogers@gmail.com

    ReplyDelete
    Replies
    1. Internet Of Today is filled with Scam? With Mills Dachin Quality jobs Delivery Assured, We have help Individuals Organization to Secure and to Recover there lost files/Password/ funds etc. We Are Hacker for Hire. I am saying leave your problem & your Worries for us to solve for you 100%✓guarrantee

      * iOS/windows/iPhone/Android Phone Hacking
      * All kind of loans
      *University Grades
      *Iclouds breaching
      *Criminal Records
      *Hacking ATM Cards
      *Binary Recoveries
      *BTC Mining
      * Cyber Scam recovery
      etc...!!!

      All you need do just Email:- *pointekhack@gmail.com
      *hyperhackerone@gmail.com *cyberhackertap@gmail.com
      *phdatabasesolution@gmail.com

      Delete

Post a Comment

Popular posts from this blog

Create Music Player app in Sketchware

A Flash Light App in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Firebase auth in Sketchware for Login Activity

Simple car racing android game in Sketchware