0

Problems in webview component (java Android).

I created a screen to receive payments:

public class PaymentOnLineFragment extends Fragment {
}

This screen has only one component webview:

View v = inflater.inflate (R.layout.activity_pagamento, null);

xml with the layout has content:

<? Xml version = "1.0" encoding = "utf-8"?><LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"    android: orientation = "horizontal"    android: layout_width = "fill_parent"    android: layout_height = "fill_parent">  <WebView android: id = "@ + id / webview"      android: layout_width = "fill_parent"      android: layout_height = "fill_parent" />

I carry my php page in webview:

webView.loadUrl("my_payment_link.php");

My problem is:

I need to update every 5 seconds my php page, so I did put in the of the page:

 "onload="setTimeout ('delayer ()', 5000)" na tag body

The page opens normally in webview the first time, but when pass the 5 seconds is the refresh, the link is opened in the default android browser (another window opens) and the webview is not updated.

I want the page to be updated within the webview own (ie in my own application).

Does anyone know how to fix this?

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • 2
    possible duplicate of [Android WebView click open within WebView not a default browser](http://stackoverflow.com/questions/9986788/android-webview-click-open-within-webview-not-a-default-browser) – Jonas Czech May 11 '15 at 21:30

1 Answers1

0

Why don't you reload the page from your android code instead of using javascript? you could do it with a thread or a handler, and call mWebView.loadUrl("http://www.websitehere.php"); every n seconds!

Sebastian Breit
  • 6,137
  • 1
  • 35
  • 53