我有3个不同的页面,目前只有第一个包含更多的逻辑和变量。当我用Nexus 7测试滑块时,我得到了这个:
07-24 09:36:01.363: D/Cordova(10976):
onPageFinished(file:///android_asset/www/index.html#/android_asset/www/testSlider.html)
07-24 09:36:01.363: D/CordovaWebView(10976): >>> loadUrlNow()
07-24 09:36:01.363: D/DroidGap(10976): onMessage(onNativeReady,null)
07-24 09:36:01.363: D/DroidGap(10976):
onMessage(onPageFinished,file:///android_asset/www/index.html#/android_asset/www/testSlider.html)
07-24 09:36:17.463: D/dalvikvm(10976): GC_CONCURRENT freed 470K, 10%
free 8084K/8967K, paused 19ms+7ms, total 83ms
那么它是关于内存还是jquery移动滑块中有大量内存泄漏? 它是否可能,因为我只有3个几乎空的页面,最后一个是滑块(不工作),它们在浏览器中工作,但不在nexus 7中。
如果有人在phonegap + jqm + Android中实现了多页应用,你能告诉我这是否可能,如果是,我怎样才能增加Nexus或仿真器中jvm的内存量或如何管理内存使用量在我的应用程序中我刚刚将一些控制台日志插入滑块以检查它是否正常工作,但我只是得到了内存行,而不是日志,就像我说的那样,它在浏览器中工作,但不在真实设备中。< / p>
代码在这里
package com.mycordova.hellocordova;
import android.R;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;
import org.apache.cordova.*;
public class HelloCordovaActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
<!DOCTYPE html>
<html>
<head>
<title>conditions</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
<script type="text/javascript">
function onload(){
$("#temperature").on("change", function(e){
var newTemp = $("#temperature").val();
console.log("newTempnewTempnewTempnewTemp---->" +newTemp)
$("#temp").val(newTemp);
});
}
</script>
</head>
<body onload="onload()">
<div data-role="page" data-theme="a">
<div data-role="header">
<h1>Conditions</h1>
</div>
<div data-role="fieldcontain">
<label for="temperature">Temperature22:</label>
<input type="range" name="temperature" id="temperature" value="15" min="-15" max="60" data-highlight="true" />
<label for="temp">Echo Temp</label>
<input type="text" value="" id="temp" />
</div>
</div>
</body>
</html>
从页面到页面的跳跃就是这样。条件页面是有问题的!
<div data-role="footer" data-position="fixed">
<div data-role="navbar" style="font-size: -2">
<ul>
<li><a href="index.html" class="ui-btn-active">Index</a></li>
<li><a href="conditions.html" data-transition="pop"
data-direction="reverse">Conditions</a></li>
</ul>
</div>
</div>
现在的情况是,滑块页面(称为条件)在它是第一页时工作正常,但是当它是第二页时它不再起作用。我试图将两个页面放在第一页,但最终结果相同。但这很有帮助,因为我责备JQM和我的jS,所以现在我知道这是别的东西。
BTW当我在浏览器中测试我的应用程序时,它无法正常工作,但是当我刷新页面时,它将开始工作。这是我做过的最奇怪的应用程序。
@tencent问了更多日志,这里是:
07-24 23:26:59.910: D/Cordova(20550): onPageFinished(file:///android_asset/www/index.html#conditions)
07-24 23:26:59.910: D/CordovaWebView(20550): >>> loadUrlNow()
07-24 23:26:59.910: D/DroidGap(20550): onMessage(onNativeReady,null)
07-24 23:26:59.910: D/DroidGap(20550): onMessage(onPageFinished,file:///android_asset/www/index.html#conditions)---> Transition to next page where that slider is.
07-24 23:27:21.490: D/SoftKeyboardDetect(20550): Ignore this event**----> I Tried to write to disabled echo-fied**
07-24 23:27:21.690: D/SoftKeyboardDetect(20550): Ignore this event
07-24 23:27:28.120: D/SoftKeyboardDetect(20550): Ignore this event
07-24 23:27:33.470: D/CordovaWebView(20550): >>> loadUrlNow()
07-24 23:27:33.470: D/DroidGap(20550): onDestroy()**--->Somewhere here it crashed and closed the app!!**
07-24 23:27:33.480: D/CordovaWebView(20550): >>> loadUrlNow()
07-24 23:27:33.480: D/CordovaWebView(20550): >>> loadUrlNow()
07-24 23:27:33.670: D/DroidGap(20550): DroidGap.onCreate()
07-24 23:27:33.690: D/CordovaWebView(20550): Origin to allow: http://127.0.0.1*
07-24 23:27:33.690: I/CordovaLog(20550): Found log level DEBUG
07-24 23:27:33.690: I/CordovaLog(20550): Changing log level to DEBUG(3)
07-24 23:27:33.690: I/CordovaLog(20550): Found preference for useBrowserHistory=false
07-24 23:27:33.690: D/CordovaLog(20550): Found preference for useBrowserHistory=false
07-24 23:27:33.700: D/DroidGap(20550): DroidGap.init()
07-24 23:27:33.700: D/CordovaWebView(20550): >>>loadUrl(file:///android_asset/www/index.html)
07-24 23:27:33.700: D/PluginManager(20550): init()
07-24 23:27:33.700: D/CordovaWebView(20550): >>> loadUrlNow()
07-24 23:27:33.710: D/CordovaLog(20550): exception firing pause event from native
07-24 23:27:33.710: D/CordovaLog(20550): null: Line 1 : exception firing pause event from native
07-24 23:27:33.710: I/Web Console(20550): exception firing pause event from native at null:1
07-24 23:27:33.710: D/CordovaLog(20550): exception firing destroy event from native
07-24 23:27:33.710: D/CordovaLog(20550): null: Line 1 : exception firing destroy event from native
07-24 23:27:33.710: I/Web Console(20550): exception firing destroy event from native at null:1
07-24 23:27:33.710: D/SoftKeyboardDetect(20550): Ignore this event
07-24 23:27:33.730: D/DroidGap(20550): onMessage(onPageStarted,about:blank)
07-24 23:27:33.730: D/Cordova(20550): onPageFinished(about:blank)
07-24 23:27:33.730: D/DroidGap(20550): onMessage(onPageFinished,about:blank)
07-24 23:27:33.730: D/DroidGap(20550): onMessage(exit,null)
07-24 23:27:33.760: D/DroidGap(20550): onMessage(onPageStarted,file:///android_asset/www/index.html)
07-24 23:27:33.770: D/CordovaWebView(20550): >>> loadUrlNow()
07-24 23:27:33.810: D/SoftKeyboardDetect(20550): Ignore this event
07-24 23:27:33.820: D/DroidGap(20550): onDestroy()
07-24 23:27:33.820: D/CordovaWebView(20550): >>> loadUrlNow()
07-24 23:27:33.820: D/CordovaWebView(20550): >>> loadUrlNow()
07-24 23:27:34.160: W/IInputConnectionWrapper(20550): showStatusIcon on inactive InputConnection
07-24 23:27:34.250: D/CordovaLog(20550): exception firing pause event from native
07-24 23:27:34.250: D/CordovaLog(20550): null: Line 1 : exception firing pause event from native
07-24 23:27:34.250: I/Web Console(20550): exception firing pause event from native at null:1
07-24 23:27:34.260: D/CordovaLog(20550): exception firing destroy event from native
07-24 23:27:34.260: D/CordovaLog(20550): null: Line 1 : exception firing destroy event from native
07-24 23:27:34.260: I/Web Console(20550): exception firing destroy event from native at null:1
07-24 23:27:34.260: D/Cordova(20550): onPageFinished(file:///android_asset/www/index.html)
07-24 23:27:34.260: D/CordovaWebView(20550): >>> loadUrlNow()
07-24 23:27:34.260: D/DroidGap(20550): onMessage(onNativeReady,null)
07-24 23:27:34.260: D/DroidGap(20550): onMessage(onPageFinished,file:///android_asset/www/index.html)
07-24 23:27:34.270: D/DroidGap(20550): onMessage(onPageStarted,about:blank)
07-24 23:27:34.290: D/Cordova(20550): onPageFinished(about:blank)
07-24 23:27:34.290: D/DroidGap(20550): onMessage(onPageFinished,about:blank)
07-24 23:27:34.300: D/DroidGap(20550): onMessage(exit,null)
07-24 23:27:36.270: D/DroidGap(20550): onMessage(spinner,stop)
07-24 23:27:36.300: D/DroidGap(20550): onMessage(spinner,stop)