PDA

View Full Version : Ext.Img not loading in device



kramprabhu
15 Nov 2012, 3:17 AM
Hi

I just testing the Ext.Img for my application, when I load image from internet, it shows both in browser and mobile device. But if I use local image, then it only shows in browser not in mobile device.

items: [
{
xtype: 'image',
height: 67,
width: 66,
src: 'http://www.sencha.com/assets/images/sencha-avatar-64x64.png'
}
]






items: [
{
xtype: 'image',
height: 67,
width: 66,
src: 'asset/icons/icon.png'
}
]

src: 'http://www.sencha.com/assets/images/sencha-avatar-64x64.png' is working fine.

src: 'asset/icons/icon.png' not loading in mobile device.

Please let me know how to fix this.

Regards
-Ram

ingo.hefti
15 Nov 2012, 5:08 AM
This is probably because the path to the image is wrong or the resource has not been included by the native packager. The packager, by default, only includes these resources (excerpt from app.json):


/**
* Extra resources to be copied along when build
*/
"resources": [
"resources/images",
"resources/icons",
"resources/startup"
],

Either change the location of the resource or edit the app.json to reflect the location of your resource.
I usually put everything in resources/images. So I'm fine with the Sencha defaults.

kramprabhu
19 Nov 2012, 12:06 AM
Hi.. When I create application from Sencha Architect I dont get app.json file.. I only get packager.json using sencha build command. Is both are same?

ingo.hefti
19 Nov 2012, 12:42 AM
I think you have app.json. Only it is generated / maintained by Architect directly. But when you have a look on file system level you should see it.

And no, it's absolutely not the same as packager.json.

kramprabhu
19 Nov 2012, 2:21 AM
I am just executing "sencha package run android_config.json" command and generating".apk" file.
This .apk file I am coping to my android mobile device.
Once installing there.. I am not able to see the images.
-Ram

ingo.hefti
19 Nov 2012, 2:59 AM
You are correct - my apologies. I thought that it's handled the 'normal' way.

I upgraded my Architect to V2.1 (haven't used it for some time now) and did a quick test. Within my project structure I created a folder called images and put an image "image01.png" in there. Then I dropped an image component into a panel and put as source "images/image01.png". The image was shown in both architect and in my browser. Then I published the project and everything was still fine.

kramprabhu
19 Nov 2012, 5:03 AM
Did you tried creating package file (.apk) file.

ingo.hefti
19 Nov 2012, 7:09 AM
yes, and I can see the image in the app on my smartphone.

Initially I had a few problems. But after reading this http://www.sencha.com/forum/showthread.php?246508-Setting-up-your-Architect-Touch-projects-to-be-used-with-Sencha-Cmd-v3 and a few trials I managed to build the apk from my little Architect project.

kramprabhu
22 Nov 2012, 5:27 AM
Did Sencha Architect created app.json file for you?
If so can you give me the steps how you created .apk files and how app.json got created using Architect.
-Thanks

ingo.hefti
23 Nov 2012, 1:00 AM
Did Sencha Architect created app.json file for you?
No, not Architect did that! I used CMD3 to build the skeleton of a new project/app and then let Architect save into that project (project names should match!). After that I did a few modifications in Architect, saved all and then built the APK with CMD3 (no success so far to do that from within Architect).