开发者

jquery-mobile loaded into an android WebView

开发者 https://www.devze.com 2023-02-28 08:53 出处:网络
I\'ve not been able to get a webpage decorated by jquerymobile to load into an Android WebView. Consider the jquery mobile demo site: http://jquerymobile.com/demos/1.0a4.1/

I've not been able to get a webpage decorated by jquerymobile to load into an Android WebView.

Consider the jquery mobile demo site: http://jquerymobile.com/demos/1.0a4.1/

final WebView browser; 

browser = (WebView) findViewById(R.id.browser_webview);
final WebSettings settings = browser.getSettings();
settings.setJavaScriptEnabled(true);
settings.setAllowFileAccess(true);
settings.setBuiltInZoomControls(false);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
browser.loadUrl("http://jquerymobile.com/demos/1.0a4.1/);

Deployed to an android device (nexus one) this just crashes. Deployed to an emulator logs report

INFO/HttpClientHelper(349): dispatch to 'http://jquerymobile.开发者_运维知识库com/demos/1.0a4.1/'
INFO/ActivityManager(51): Displayed activity com.xxx.android/.presentation.activities.SomeActivity: 4194 ms (total 4194 ms)
DEBUG/dalvikvm(349): GC freed 3005 objects / 220168 bytes in 76ms

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys'
pid: 349, tid: 361  >>> com.retrieve.android <<<
signal 11 (SIGSEGV), fault addr 00000004
r0 004bf6f1  r1 00000014  r2 00000001  r3 004bf63c
r4 00000004  r5 004bf700  r6 00000000  r7 00000000
r8 4517ecf8  r9 426bdf1c  10 00000354  fp 426bdf18
ip ad080090  sp 4517d784  lr aa17a2c7  pc aa17e966  cpsr 00000030
#00  pc 0017e966  /system/lib/libwebcore.so
#01  lr aa17a2c7  /system/lib/libwebcore.so
code around pc:
aa17e954 e69eda00 f7ffa813 6f22fb91 b0216ea6
aa17e964 59a00094 1c27bdf0 683b378c 22019903
aa17e974 18471ad0 971b2000 2f00901a da009708
code around lr:
aa17a2b4 28004798 1c28d00f fad0f7c4 f0041c28
aa17a2c4 9b05f9b1 181f9903 29009705 1c28d00d
aa17a2d4 fc68f003 6828e009 680230ac 47901c28
stack:
4517d744  004bf7a0  [heap]
4517d748  0034a368  [heap]
4517d74c  aa17d36b  /system/lib/libwebcore.so
4517d750  00000000
4517d754  00000000
4517d758  004bf700  [heap]
4517d75c  004bf7a0  [heap]
4517d760  004bf700  [heap]
4517d764  00000000
4517d768  aa17cda5  /system/lib/libwebcore.so
4517d76c  aa17f2f9  /system/lib/libwebcore.so
4517d770  00000000
4517d774  00000000
4517d778  df002777
4517d77c  e3a070ad
4517d780  004bf63c  [heap]
#00 4517d784  004bf63c  [heap]
4517d788  004bf700  [heap]
4517d78c  00000000
4517d790  00000000
4517d794  aa17a2c7  /system/lib/libwebcore.so
4517d798  0030eb60  [heap]
4517d79c  00000000
4517d7a0  0034a368  [heap]
4517d7a4  00000000
4517d7a8  00000000
4517d7ac  00000000
4517d7b0  0030eb60  [heap]
4517d7b4  4517d898
4517d7b8  00000000
4517d7bc  004bf63c  [heap]
4517d7c0  00000000
4517d7c4  00000003
4517d7c8  0000024e

DEBUG/Zygote(29): Process 349 terminated by signal (11)
INFO/WindowManager(51): WIN DEATH: Window{43d2e3a8 com.xxx.android/com.xxx.android.presentation.activities.SActivity paused=false}


Most all my issues went away by replacing jquery-1.5.2.min.js with jquery-1.5.2.js.

The rest of my issues were resolved by replacing relative paths to link and script resources with absolute paths.


Why not check out the phonegap source file for the DroidGap class responsible for loading its Android web view? Many people are routinely using jquery mobile, among other frameworks, with phonegap on android. I'm sure you'll find what you're looking for in there:

https://github.com/sintaxi/phonegap/blob/master/android/framework/src/com/phonegap/DroidGap.java


To see an example of PhoneGap loading the jQuery Mobile demo site, check out http://www.mobiledevelopersolutions.com/home/start/included-demo-apps

0

精彩评论

暂无评论...
验证码 换一张
取 消