Note that there are some explanatory texts on larger screens.

plurals
  1. POrestoring Webview(page) from an android activity
    primarykey
    data
    text
    <p>I'm loading a URL from the Main activity, </p> <pre><code>super.loadUrl("file:///android_asset/www/index.html"); </code></pre> <p>after performing some activities on the web, on a event, I call another activity using droidgap.<br> I'm not able to give back control to the webpage on finishing the activity. Basically I need restoring/webpage mechanism where I left to the android activity.</p> <p>Below are some of the snippets, MyClass(DroidGap) giving access to JS-</p> <pre><code>public class MyClass extends DroidGap{ static WebView mAppView; static DroidGap mGap; private String RInfo[] = new String[5]; public MyClass(DroidGap gap, WebView view) { mAppView = view; mGap = gap; } public void initiateDP(){ Intent intent = new Intent(mGap, DPActivity.class); mGap.startActivity(intent); } </code></pre> <p>MainActivity :-</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); super.setIntegerProperty("loadUrlTimeoutValue", 40000); mc = new MyClass(this, appView); appView.addJavascriptInterface(mc, "MyCls"); super.loadUrl("file:///android_asset/www/index.html"); } </code></pre> <p>Index.html:-</p> <pre><code>alert('shaken'); var r = window.confirm('Do you want to enable remote'); if(r == true) { // alert('before redirecting'); window.MyCls.initiateDP(); } </code></pre> <p>this starts the DPActivity. So from DPActivity, I have to come back to the page where I left. in DPActivity :-</p> <pre><code>if(MyClass.mAppView.canGoBack()) { MyClass.mAppView.goBack(); } else{ finish(); } </code></pre> <p>this is not happening. Please suggest me any other mechanism or correct me if wrong.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload