简体   繁体   English

在人行横道浏览器中多次单击任何按钮不起作用

[英]Clicking any button more than once in crosswalk browser does not work

Problem: 问题:

Clicking any button (input tag in html) of any html page more than once in crosswalk browser (XWalkView) does not work in Android. 在人行横道浏览器(XWalkView)中多次单击任何html页面的任何按钮(html中的输入标签)在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, ie 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.) (单击第一次工作,但在此之后单击按钮除了Eclipse IDE的Logcat中的跟随错误之外没有任何响应,即单击输入类型文件首次显示文件选择器但多次单击同一按钮,没有得到响应。但重新启动应用程序后重复该过程。这真的是一种奇怪的行为。)

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 的index.html

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

MainActivity.java 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);
    }
}

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 这里提到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM