3
I want to implement Swipe To Refresh on my Webview, is that possible? I know you have Pull To Refresh but I’m not able to download add-ons (dependencies) at the moment. I did a lot of research on the Internet and found something like this:
browser.loadUrl("http://urlaqui");
swipeView.setColorScheme(android.R.color.holo_blue_dark,android.R.color.holo_blue_light, android.R.color.holo_green_light,android.R.color.holo_green_dark);
swipeView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
@Override
public void onRefresh()
{
swipeView.setRefreshing(true);
( new Handler()).postDelayed(new Runnable()
{
@Override
public void run()
{
swipeView.setRefreshing(false);
browser.loadUrl("http://não-atualizar-somente-esta-url");
}
}, 4000);
}
});
}
In this case, when the user refreshes, they will always return to the specified url. How do you refresh the page regardless of which url it is?
Thank you very much, thank you in advance.
webView.Reload(); doesn’t solve?
– Thiago Luiz Domacoski
@Thiagoluizdomacoski Hello friend, thank you so much for answering. Sorry to ask, I am beginner in programming, in this case replace: browser.loadUrl("site"); by webView.Reload(); ?
– Tech Positivo
Exact ! instead of calling the url again call the Reload inside the run!
– Thiago Luiz Domacoski
@Thiagoluizdomacoski Ok friend, thank you very much. I will test now ;)
– Tech Positivo
@Thiagoluizdomacoski Hello friend, I tested here and it didn’t work. The app gave 'force close' :/ . But thanks for the help.
– Tech Positivo