2013-03-17 64 views
1

我正在android上使用PhoneGap/Mobile jQuery製作應用程序。我使用phonegap版本2.3.0無法編輯輸入字段中的文本獲取錯誤:beginbatchedit on inactive inputconnection

我能夠編輯窗體中的一些字段,但是當我開始填充其他字段時,它不顯示文本。

我看到很多人得到這個問題,但沒有一個人得到了一個解決方案尚未

下面是一些鏈接的人們得到了同樣的問題

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

我不t有很多android的使用經驗,我正在使用帶電話的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> 
+0

向我們展示您的代碼,您嘗試過做什麼? – Gajotres 2013-03-17 10:07:50

+0

我不是一個Android開發人員。我按照phonegap的指南創建android應用程序並按照他們的說法設置它們。我更新了這個問題。代碼中有什麼錯誤? – 2013-03-17 10:27:44

回答

0

我是用在輸入字段maxlengthmax和領域並沒有進入角色比最大長度,最大更莫名其妙地違反任何規則限制我之後它會停止顯示字段。

相關問題