Clicking any button more than once in crosswalk browser does not work
Asked Answered
S

1

8

Problem:

Clicking any button (input tag in html) of any html page more than once in crosswalk browser (XWalkView) does not work in Android. (Clicking first time works, but clicking button after that any times does not give any response except for following error in Eclipse IDE's Logcat, i.e. clicking input type file shows file chooser first time but clicking the same button more than once, getting no response .But after restarting app the process repeats. It's really an odd behaviour.)

Error:

This error message is shown on every click of any button(input tag).

11-20 17:32:04.019: E/chromium(31406): [ERROR:xwalk_autofill_client.cc(170)] Not implemented reached in virtual void xwalk::XWalkAutofillClient::OnFirstUserGestureObserved()

Code:

index.html

<html>
<body>
<form>
<input type="file" accept="*/*"/>
<input type="submit"/>
</form>
</body>
</html>

MainActivity.java

import org.xwalk.core.XWalkView;

import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;

public class MainActivity extends Activity {
    private LinearLayout linearLayout;
    private XWalkView xWalkWebView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        linearLayout = (LinearLayout) findViewById(R.id.LinearLayout1);
        xWalkWebView = new XWalkView(this.getApplicationContext(), this);
        xWalkWebView.load("file:///android_asset/index.html", null);
        linearLayout.addView(xWalkWebView);
    }
}
Stirring answered 20/11, 2015 at 12:51 Comment(0)
S
7

Adding following code solved the problem:

   @Override
   protected void onPause() {
       super.onPause();
       if (mXwalkView != null) {
           mXwalkView.pauseTimers();
           mXwalkView.onHide();
       }
   }

   @Override
   protected void onResume() {
       super.onResume();
       if (mXwalkView != null) {
           mXwalkView.resumeTimers();
           mXwalkView.onShow();
       }
   }

   @Override
   protected void onDestroy() {
       super.onDestroy();
       if (mXwalkView != null) {
           mXwalkView.onDestroy();
       }
   }

   @Override
   protected void onActivityResult(int requestCode, int resultCode, Intent data) {
       if (mXwalkView != null) {
           mXwalkView.onActivityResult(requestCode, resultCode, data);
       }
   }

   @Override
   protected void onNewIntent(Intent intent) {
       if (mXwalkView != null) {
           mXwalkView.onNewIntent(intent);
       }
   }

Mentioned here

Stirring answered 21/11, 2015 at 7:11 Comment(2)
What version of Crosswalk were you using? I'm seeing this issue now but your code above didn't help to resolve it.Cartage
@Cartage Error message is still there but the Problem (of clicking any button more than once in crosswalk browser not working) was solved.Stirring

© 2022 - 2024 — McMap. All rights reserved.