tags:

views:

49

answers:

2

Hi,

After a successful web view is loaded, now after some processing on the HTML page, I would like to return the control to the main screen. Is this possible in Android?

The control after the webview is launched, is in the browser, so after I make some ajax calls and then get a positive server side message. I would like the control goback to my Webview Activity.

A: 

Call finish() in the Activity with the WebView, and control will return to the Activity with the ListView.

CommonsWare
I think I have to rephrase my question.I would like to know if the javascript variables have been set properly from the webview and if set, go back to the listview
Sana
@Sana: That will be substantially more difficult. Use `addJavascriptInterface()` to make a Java object available to Javascript. Then, use a `javascript:` URL and `loadUrl()` in your Java code to execute some Javascript that checks your variables, then calls a method on the object you injected with `addJavascriptInterface()` to return the result for you. If you are simply looking to wait for the page to be loaded in its entirety, try using a `WebViewClient` and `onPageFinished()`.
CommonsWare
A: 

Thanks!

Let me post the code which worked for me

final class DemoJavaScriptInterface { // public String loginIDInfo = "URL selected from Main Screen :+"+nicu_app.urlSelected; private String someData = "Arun Sanjay"; public String getData() { return someData; } public void setData(String abc) { someData = abc; } }

In the HTML view

I was calling a function setPass which was initializing the variables.

function setPassData() { demo.setData("pass"); }

Sana