2011-06-07 62 views
0

我想在電話應用程序中使用dojo。我嘗試過在dojo中測試dojo的應用程序,但他們沒有在emulator中顯示任何東西。任何人都可以幫助我如何在phonegap應用程序中使用dojo。dojo with phonegap for android

感謝 Himabindu

+0

你能更具體?您是否嘗試過Dojo網站中的dojox.mobile演示頁面?在使用PhoneGap編譯它之前,您應該有一個工作網站。 – 2011-06-07 08:18:04

+0

是的,我試了他們..我創建了一個動態的web項目,我測試了tweetview applocation.It工作正常。但我想要相同的應用程序運行在emulator.For爲此我創建了android項目。由於phonegap框架允許html代碼在android中運行,我將dojo複製到項目的www文件夾中,並使用tweetview.html.I不知道它是否正確或不是。它不在模擬器中顯示任何內容。 – Hima 2011-06-07 09:38:30

+0

我相信移動的東西在dojox/...樹下。你有沒有複製dojox樹? – 2011-06-08 04:10:39

回答

0

嘗試重命名tweetview.html到的index.html。

PhoneGap入口點文件名需要與來自本地源的文件名相匹配。在Android上,連接來自src/{com.package}/{activityname} .java。

super.loadUrl("file:///android_asset/www/index.html"); 
2

Android有一些動態加載的問題。這意味着你必須定製dojo 1.7.1。

要進行自定義生成,您需要src version of dojo

我擴展配置文件 「baseplus.profile.js」 在目錄中找到 「道場/ UTIL/builsscripts /型材/」 如下:

dependencies = { 
    selectorEngine: "acme", 
    layers: [ 
      { 
// This is a specially named layer, literally 'dojo.js' 
// adding dependencies to this layer will include the modules  
// in addition to the standard dojo.js base APIs.  
      name: "dojo.js",  
      dependencies: [  
       "dijit._Widget",  
       "dijit._Templated",  
       "dojo.fx",  
       "dojo.NodeList-fx",  
//this wasn't included in the standard build but necessary 
       "dojo._firebug.firebug",  
//my used dojo requirements 
       "dojox.mobile.parser",  
       "dojox.mobile",  
       "dojox.mobile.Button",  
       "dojox.mobile.SwapView",  
       "dojox.mobile.ScrollableView",  
       "dojox.mobile.TabBar",  
       "dojox.mobile.SpinWheelTimePicker",  
       "dojox.mobile.compat"  
      ]  
     }  
], 

prefixes: [ 
     ["dijit", "../dijit" ],  
     ["dojox", "../dojox" ]  
]  
} 

,你必須執行build.sh(在Unix/OSX)或build.bat(Windows)的命令「./build.sh action = release profile = profiles/myBaseplus.profile.js -r」

成功構建後,您會找到dojo。 js文件在「dojo/release/djojo/dojo.js」中。

您只需要此文件。

從來沒有少,你將還需要以下require語句在HTML文件中:

require([  
        "dojox/mobile/parser",  // (Optional) This mobile app uses declarative programming with fast mobile parser  
        "dojox/mobile",    // (Required) This is a mobile app.  
        "dojox/mobile/Button",  
        "dojox/mobile/SwapView",  
        "dojox/mobile/ScrollableView",  
        "dojox/mobile/TabBar",  
        "dojox/mobile/SpinWheelTimePicker",  
        "dojox/mobile/compat"  // (Optional) This mobile app supports running on desktop browsers  
        ], 
        function(parser, mobile, compat){  
        //Optional module aliases that can then be referenced inside callback block  
        }  
); 
+0

具體來說,這[android bug](http://code.google.com/p/android/issues/detail?id=5343) – peller 2012-03-23 20:16:22