I use WebView
, I open the site normally, but I need to access it by passing a value from a given site field to TextView
.
Is it possible to do this?
Follow the code below:
public class Inicio extends AppCompatActivity {
TextView recuperarvalor;
WebView site;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_inicio);
recuperarvalor = (TextView) findViewById(R.id.idtextview);
site = (WebView) findViewById(R.id.idwebview);
site.loadUrl("https://nomedosite");
WebSettings settings = site.getSettings();
settings.setJavaScriptEnabled(true);
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
settings.supportZoom();
settings.setBuiltInZoomControls(true);
settings.setTextZoom(150);
settings.setSupportZoom(true);
settings.setDomStorageEnabled(true);
site.loadUrl("javascript:var x = document.getElementById('live_bid');");
site.setWebViewClient(new WebViewClient() {
@Override
public void onLoadResource(WebView view, String url) {
super.onLoadResource(view, url);
site.loadUrl("javascript:var x = document.getElementById('live_bid');");
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
}
}