【问题标题】:Can't edit text in input field getting error : beginbatchedit on inactive inputconnection无法编辑输入字段中的文本出现错误:beginbatchedit on inactive inputconnection
【发布时间】:2013-03-20 19:40:52
【问题描述】:

我正在 Android 上使用 PhoneGap/Mobile jQuery 制作应用程序。我正在使用 phonegap 2.3.0 版

我可以编辑表单中的某些字段,但是当我开始填写其他字段时,它不会显示字段内的文本。

我看到很多人遇到这个问题,但还没有人找到解决方案

这是人们遇到相同问题的一些链接

http://community.phonegap.com/nitobi/topics/phonegap_2_0_0_2_1_0_and_android_4_1_inputtext_text_not_taking_input_after_some_seconds http://community.phonegap.com/nitobi/topics/android_version_4_1_1

我对android没有太多经验,我正在使用带有phonegap的HTML5

我习惯使用他们网站上的教程设置应用程序http://docs.phonegap.com/en/2.3.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android

它创建了应用程序,我将应用程序命名为 phonetest,并且我的主 java 文件包含此代码。

/*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
 */

package com.inam.phonetest;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.util.Log;

import org.apache.cordova.*;


    public class phonetest extends DroidGap
    {
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            // testing asdfsd
            try
            {
                    String pName = this.getClass().getPackage().getName();
                    Log.w("myApp", "no network"+"/data/data/"+pName+"/databases/");
                    this.copy("cps.db","/data/data/"+pName+"/databases/");
                    //this.copy("0000000000000001.db","/data/data/"+pName+"/databases/file__0/");
            }
            catch (IOException e)
            {

                e.printStackTrace();
            }

            File database=getApplicationContext().getDatabasePath("cps.db");

            if (!database.exists()) {
                // Database does not exist so copy it from assets here
                Log.w("Database", "Not Found");
            } else {
                Log.w("Database", "Found");
            }


            super.onCreate(savedInstanceState);
              ////////////
            setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
            super.loadUrl("file:///android_asset/www/index.html");
        }

        void copy(String file, String folder) throws IOException 
        {

         File CheckDirectory;
         CheckDirectory = new File(folder);
         if (!CheckDirectory.exists())
         { 
          CheckDirectory.mkdir();
         }

            InputStream in = getApplicationContext().getAssets().open(file);
            OutputStream out = new FileOutputStream(folder+file);

            // Transfer bytes from in to out
            byte[] buf = new byte[1024];
            int len; while ((len = in.read(buf)) > 0) out.write(buf, 0, len);
            in.close(); out.close();

        }
    }

我的 HTML 文件有这个脚本

<table><tr>
<td><input  name="last_name" id="last_name" type="text" class="mytextfield"  style="height:35px; width:250px;" tabindex=""  value="" /></td>
      <td  ><font color="red">*</font>Home Phone Number </td>
      <td  ><input  name="phone_num" id="phone_num"  value=""  tabindex="" type="text" pattern="[0-9]*" maxlength="10" /></td>
    </tr>
</table>

【问题讨论】:

  • 向我们展示您的代码,您尝试过做什么?
  • 我不是一个安卓开发者。我按照 phonegap 的指南创建 android 应用程序并按照他们所说的进行设置。我更新了问题。代码有什么问题吗?

标签: android cordova jquery-mobile


【解决方案1】:

我在输入字段中使用了maxlengthmax,并且该字段并没有限制我输入超过 maxlength 和 max 的字符,这以某种方式违反了某些规则,之后它停止在字段中显示单词。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-10
    • 2011-07-19
    • 2015-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多