本文介绍了HTML表单输入在Eclipse中的PhoneGap Android开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题。我最近开发了一个应用程序使用的PhoneGap和X code IOS。很顺利,他们在App Store中,一切工作。一个元件的是一个简单的电子邮件的形式,写在HTML。它看起来是这样的:

 <表格名称=emailformbtnID =emailformbtn的onsubmit =submitHandler(E);行动=#emailfromBtn>
                    要:LT;输入类型=电子邮件NAME =emailvarto/>
                    消息:< textarea的COLS =40行=8ID =emailmessagebtnNAME =emailmessage>电邮讯息和LT; / textarea的>
                    <输入类型=按钮值=发送的onsubmit =submitHandler(E);的onclick =emailProcessfromBtn();/>
                < /表及GT;

作品使用的PhoneGap和jQuery Mobile的IOS。所以我决定将应用程序转换成Android系统。所有转换ObjectiveC到Java,剩下的应该工作,因为他们都是的PhoneGap /科尔多瓦。

我使用的科尔多瓦2.0和Android 4.1

很多这样做,但是当我尝试触摸电子邮件领域的投入,它什么也不做,和Eclipse显示消息:

 视图没有连接到一个窗口。

它是一个的PhoneGap /科尔多瓦元素。我甚至不知道它是什么想说的。是否与Android和jQuery Mobile的问题,或者使用PhoneGap的不调用原生键盘确实感人输入字段的Andr​​oid?

在这个问题上的任何指示或建议将不胜AP preciated。

只是为了让事情更清晰,即使我跟随的PhoneGap的配置指南托特他的信,以下是Activity.java文件的内容:

 包uk.co.testdevelopment.testapp.droidapp;进口android.os.Bundle;
进口android.view.Menu;
导入org.apache.cordova *。公共类MainActivity扩展DroidGap {@覆盖
公共无效的onCreate(捆绑savedInstanceState){
    super.onCreate(savedInstanceState);
    super.loadUrl(文件:///android_asset/www/index.html);
}@覆盖
公共布尔onCreateOptionsMenu(菜单菜单){
    。getMenuInflater()膨胀(R.menu.activity_main,菜单);
    返回true;
}
}


解决方案

你确定你的活动延长'DroidGap ,而不是活动?这肯定听起来很奇怪,看起来更像是比什么科尔多瓦配置的问题与你的HTML

I have a weird problem. I recently developed an App for ios using Phonegap and Xcode. It went well, they are in the App store, everything worked. One of the elements is a simple email form, written in HTML. It looks like this:

<form name="emailformbtn" id="emailformbtn" onsubmit="submitHandler(e);" action="#emailfromBtn">
                    To: <input type="email" name="emailvarto"/>
                    Message:<textarea cols="40" rows="8" id="emailmessagebtn" name="emailmessage">Email Message</textarea>
                    <input type="button" value="send" onsubmit="submitHandler(e);" onclick="emailProcessfromBtn();"/>
                </form>

Works in ios using Phonegap and Jquery mobile. So i decided to convert the app into Android. Converting all the ObjectiveC into Java, and the rest should work because they are both Phonegap/Cordova.

I am Using Cordova 2.0 and Android 4.1

A lot of it does, but when I try to touch the input of the emails field, it does nothing, and Eclipse displays the message:

The View is not attached to a window. 

Its a Phonegap/Cordova element. I'm not even sure what its trying to say. Is there an issue with Android and Jquery mobile, or does touching input fields in Android using phonegap not invoke native Keyboards?

Any direction or advice on this problem would be greatly appreciated.

Just to make things clearer, even though I followed Phonegap's configuration guide tot he letter, Here is the contents of the Activity.java file:

package uk.co.testdevelopment.testapp.droidapp;

import android.os.Bundle;
import android.view.Menu;
import org.apache.cordova.*;

public class MainActivity extends DroidGap {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.loadUrl("file:///android_asset/www/index.html");
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}
}
解决方案

Are you sure your activity is extending 'DroidGap' and not 'Activity'? This definitely sounds wierd and looks more like a problem of the cordova configuration than anything to do with your html

这篇关于HTML表单输入在Eclipse中的PhoneGap Android开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 09:03