- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我遵循了基本 Phonegap 教程(Eclipse、Android SDK、ADT Phonegap)中的所有步骤,我在 assets/www 文件夹中创建了一个 HMTL 页面,运行它,它显示了我的 hello world html
.
第 2 步:我在我的 HTML 页面的 CDN 上添加了对 jQuery Mobile 的引用:它起作用了。
第 3 步:我创建了一个新的 html 页面,复制粘贴了下面的代码,这是来自 Phonegap 网站的一个示例,但它...什么也没做。甚至没有警报(我添加了一些警报以查看是否发生了什么,但即使是 onDeviceReady 事件也不会触发。
我有 Phonegap JAR,cordova-1.7.0.js
在我的 assest/www
目录,但可能缺少某些内容。
有人能帮帮我吗?
我还尝试了 Phonegap 站点的另一个示例(“设备属性”示例),但它仍然不起作用。
这是全新的 Eclipse 安装,我已将 Android 版本设置为 2.3.3,并且我使用的是 Phonegap 1.7.0。
================
我又试了一些,现在可以重现错误,但不知道为什么会这样。
所以我用 Phonegap 示例项目创建了一个新项目,它工作正常。
因此,我将该项目中的所有 Assets (1 个 html、2 个 js 和 1 个 css)复制到我的项目中,让应用程序以该 html(来 self 的 Activity 类)开始,它就可以工作了。
现在是有趣的部分(不是):我将起始页重置为我的“旧”index.html(这是 jQuery 移动版),然后单击示例 html 的链接,它不起作用。
所以示例 html 作为启动:它有效,示例 html 通过链接打开:无效。
当我加载其他不能用作起始页的 html 页面时,它们也可以正常工作,而不是通过起始页打开它们。
那么,我的 jQuery Mobile 驱动的索引页面是否可能导致问题? (我将复制粘贴下面的代码)。
EDIT2:当我使用非 jQuery Mobile 索引页面并链接到正常的 <A href>
时链接到示例 html,它也有效。所以这越来越多地暗示我认为 jQuery Mobile 妨碍了我......
链接代码是这样的:
<li><a href="index4.html" data-transition="none">phonegap example</a></li>
jQuery Mobile 主页:
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<link rel="stylesheet" href="http://www.verfrisser.net/kalender/mobile/verfrisser.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>De NerdNight kalender</h1>
<a href="about.html" data-rel="dialog">About</a><a href="genereren.html" data-transition="pop">Genereren</a>
</div><!-- /header -->
<div data-role="content">
<img id="verfrisserlogo" src="verfrisserlogo.png" />
<ul data-role="listview" data-inset="true" data-filter="false">
<li><a href="2011.html" data-transition="none">2011</a></li>
<li><a href="2012.html" data-transition="none">2012</a></li>
<li><a href="2013.html" data-transition="none">2013</a></li>
<li><a href="testing.html" data-transition="none">testing</a></li>
<li><a href="testing2.html" data-transition="none">testing2</a></li>
<li><a href="testing3.html" data-transition="none">testing3</a></li>
<li><a href="index4.html" data-transition="none">phonegap example</a></li>
</ul>
</div><!-- /content -->
<div data-role="footer">
<h6>(C) Verfrisser 1998 till now</h6>
</div><!-- /footer -->
</div><!-- /page -->
</body>
</html>
================
示例 HTML(仅在页面中显示文本“对话框将报告网络状态”)
<!DOCTYPE html>
<html>
<head>
<title>navigator.network.connection.type Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load //
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is loaded and it is now safe to make calls Cordova methods
alert ('stand alone');
//
function onDeviceReady() {
alert ('onDeviceReady');
checkConnection();
}
function checkConnection() {
var networkState = navigator.network.connection.type;
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.NONE] = 'No network connection';
alert('Connection type: ' + states[networkState]);
}
</script>
</head>
<body>
<p>A dialog box will report the network state.</p>
</body>
</html>
最佳答案
使用默认行为,下一页将作为 DOM 元素加载,因此不会再次调用 javascript deviceready
。
尝试使用以下方法之一以正常方式运行它:
<li><a href="testing2.html" data-transition="none" rel="external">testing2</a></li>
或者
<li><a href="testing2.html" data-transition="none" data-ajax="false">testing2</a></li>
解释:
When a link is clicked, jQuery mobile will make sure the link isreferencing a local URL, and if so, it'll prevent the link's defaultclick behavior from occurring and request the referenced url via Ajaxinstead. When the page returns successfully, it will set thelocation.hash to the new page's relative url.
If the Ajax request is successful, the new page content is added to the DOM, all mobile widgets are auto-initialized, then the new page is animated into view with a page transition.
有关更多详细信息,请查看 doc
关于android - Phonegap 在 Android 模拟器中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10922381/
我使用 iOS 4.2 和 Xcode 3.2.5 创建了一个通用二进制文件。我正在尝试对应用程序进行一些自动化测试,由于 iPad 和 iPhone 版本之间的界面略有不同,因此我有单独的 UIAu
这是一个概念性的问题。如果有人能澄清背后的故事,那就太好了。 我了解模拟器和模拟器之间的区别。 模拟器:模仿设备环境(硬件、网络功能等)。与设备相比,我们更有可能得到非常接近的结果。 模拟器:使用正在
是否有任何现成的解决方案可以模拟或模拟 LDAP 服务器功能? 或者是否可以在 ubuntu 上安装 ldap 服务器(仅适用于 localhost)? 如果它不是来自 localhost 的 jsu
我正在将我的应用程序修复为通用二进制文件。模拟器上的测试似乎默认使用 iPad。对于诸如检查方向和小型 UI 更新之类的小修正,我能找到的获取 iPhone 版本的唯一方法是插入我的 iPhone 并
Emulator: emulator: WARNING: Could not connect to proxy at ::1:8080: Unknown error ! - Android 将 And
我的应用程序在 ios 4.3 模拟器中运行良好,但在 ios 5 模拟器中运行不佳。我的 iPhone 上有 ios 5,我的应用程序确实可以在 iPhone 上运行。 该应用在所有这三种环境中都可
我在 azure 上制作了移动应用程序,并将其快速启动为 xamarian.forms,并且(在未能发布下载的表 api 应用程序并决定在浏览器中编辑它之后)下载了他们提供的客户端应用程序。然后,当我
Emulator: emulator: ERROR: x86 emulation currently requires hardware acceleration! Emulator: Process
我试图在 iOS 10.3 模拟器上将任意文件从我的应用程序的沙箱保存到 iCloud Drive。 iCloud Drive 已启用并且我已登录。如果我在模拟器上打开 iCloud Drive 应用
有谁知道一个小型、快速、支持 DOM 层的 javascript 模拟器?在 C/C++ 中? 问题:我需要在爬虫应用程序中对 javascript 的基本支持,并且想知道除了以下选项之外是否还有其他
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
我是 Xcode 开发新手。我在基于 Lion 的 Mac 上安装了 Xcode 4.3.1,并取消设置 ~/Library 上的隐藏标志。 我在这里读到了有关 iPhone/iPad 模拟器的信息
我已在 VisualStudio 2015 AZURE SDK 2.9、C# 中创建辅助角色 我在每个方法的开头添加了断点: public override void Run() {
全部。我已经安装了 Azure SDK 1.7。解决方案中的所有程序集都是使用“任何 CPU”设置进行编译的。但是当我在我的计算机上的 Azure 模拟器中启动解决方案时,其中之一失败了。该错误非常奇
有没有独立的 WAP 模拟器来模拟诺基亚 6600 和索尼爱立信 MIDP 手机的 waop 网站? 我正在创建一个 WAP 门户,我不想每次都将所有文件上传到网络上,然后将其加载到 Opera Mi
我已经安装了 Tizen 的 Visual Studio Code 扩展,并且(看起来)进展顺利。 但是,当我启动 Tizen 模拟器管理器时,我没有安装任何平台,并且当我尝试安装平台时,没有可用的平
我目前正在我的 jquery mobile/phonegap 应用程序中处理表单。在此表单中,我有两个选择列表。它们在我的桌面浏览器(firefox、safari、chrome)中都能正常工作。 奇怪
我尝试制作一个分辨率为 480x480 像素的模拟器。但是模拟器永远不会完成启动。它卡在 Android Logo 页面上。分辨率有限制吗? 最佳答案 模拟器 is not smart about s
我不知道如何在虚拟设备上启用快照功能。该选项是灰色的,创建或编辑虚拟设备时没有设置。我使用的是最新版本的 SDK 工具修订版 22.6.3 这是我的窗口的样子:Create new Android V
我正在尝试使用具有特定屏幕分辨率的模拟器,但是当我将屏幕参数设置为我需要的参数时,键盘消失了。这样我就没有后退按钮,主页按钮..任何想法如何解决这个问题?这是我在 AVD 管理器中设置的:屏幕分辨率:
我是一名优秀的程序员,十分优秀!