Android 无法编辑输入字段中的文本获取错误:未激活inputconnection上的beginbatchedit
我正在android上使用PhoneGap/Mobile jQuery制作一个应用程序。我正在使用phonegap 2.3.0版 我可以编辑表单中的一些字段,但当我开始填充其他字段时,它不会显示字段中的文本 我看到很多人都遇到了这个问题,但还没有人找到解决办法 下面是一些人们遇到同样问题的链接 我对android没有太多的经验,我正在使用HTML5和phonegap 我使用他们网站上的教程来设置应用程序 它创建应用程序,我将其命名为我的应用程序phonetest,我的主java文件包含此代码Android 无法编辑输入字段中的文本获取错误:未激活inputconnection上的beginbatchedit,android,cordova,jquery-mobile,Android,Cordova,Jquery Mobile,我正在android上使用PhoneGap/Mobile jQuery制作一个应用程序。我正在使用phonegap 2.3.0版 我可以编辑表单中的一些字段,但当我开始填充其他字段时,它不会显示字段中的文本 我看到很多人都遇到了这个问题,但还没有人找到解决办法 下面是一些人们遇到同样问题的链接 我对android没有太多的经验,我正在使用HTML5和phonegap 我使用他们网站上的教程来设置应用程序 它创建应用程序,我将其命名为我的应用程序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>
我在输入字段中使用了maxlength和max,该字段没有限制我输入超过maxlength和max的字符,这在某种程度上打破了任何规则,之后它就不再显示字段中的单词 给我们看看你的代码,你试过做什么?我不是一个android开发者。我按照phonegap的指南创建android应用程序,并按照他们所说的进行设置。我更新了问题。代码中有什么错误吗?