I am working on a Flex 4.5 app tageting Android. In different views the app needs to load and display images which I have deployed as part of the app.
Where do I put these images? And how do I load them?
I am familiar with #Embed for images, but this doesn't seem to be the correct approach in this case. I also know how to load from the file system, but I really don't know how to include my images as part of the app for distribution.
Thanks if you can help.
Gary
This worked for me in a mobile app that I wrote in Flex:
I have the following files:
src/assets/images/myImage.png
src/myApp.mxml
Inside myApp.mxml I have an image that references the one in the assets:
<s:Image source="../assets/images/myImage.png" />
I have NO idea why I have to go up one directory to make this work as the assets folder is in the same folder as the MXML file... but this is what worked for me.
Related
Greetings dear readers,
I have this query which the team is facing. We are developing a hybrid app for android platform and ran into one issue that seems to get complicated.
Here it goes.
Team is calling static HTML pages(no control on html content modification) in a web view, the html page content involves images which are taken from asset folder. Now when we are debugging the application on android device, asset folder images are getting copied automatically in gallery.
I am not a native coder but it seems asset folder images will be copied automatically. Please correct me if I am wrong. Is there any way, When I debug my app on device I could restrict this automatically copying of asset images to device gallery.
As I am not from Android, this might be the silly question but any help in this scenario would be highly appreciated.
I have researched on google to find out possible fix but unable to find one.
Guys, please suggest.....Any leads on this....
If you don't want your photos being accessible from gallery, add .nomedia file to the folder copied onto the device. This will prevent photos from appearing into gallery.
I try to make Webview from to display application/x-shockwave-flash embed element in my app, but i have blank gray screen on emulator and white on device. There are many topics about this problem but any1 really solved.
I explore log of simillar app and see: file//android_asset/index.html. So question... this static file or i can get it from web or modify it.
I trying get my data video.loadDataWithBaseURL() from web, but can i have that data from local storage?
Maybe I said something wron but it's look for me like 'convert web data to local'?? Can some one help my in my problem or explain in this question.
Thank you.
file://android_asset/ is a way that allows android apps access assets by a network-based URI. But assets represent neither local nor online files, they are packed into your apk. Put any files in assets folder in a android project and they will be packed into the apk file by the builder.
I have built an Android App, using a jQuery Mobile index.html file "wrapped" inside Java using the Android SDK on Eclipse.
However, although the images appear OK within the Dreamweaver "Live" view for jQuery mobile,
they don't appear in the emulator in Android SDK after successful build.
I have added the image files within an image folder in the RES/mpdi folder of the project, and within the index.html file they are referenced as images/"...png" etc
Should I have changed the path in any way in the index.html file?
Also, they are 290x381 pixels - should I have had a different size for the AVD?
Thanks in advance!
David
I will assume you are using something like phonegap
phonegap has a whitelist that tells the app which URLs it's allowed to access. You can also add a * to it, as described http://www.anujgakhar.com/2011/11/22/phonegap-gotcha-error-whitelist-rejection/ found in in the /res/xml/phonegap.xml file
I am writing an android application which has a lot of images in it.
I do not want to keep these images as a part of my apk file because that will make the size of the apk file very huge.
I have written the application in a way that it loads these images at runtime from the sdcard from some predefined location. Now my problem is that how do i provide these images to the user who wants to install my application. Since the images are not a part of the project (i.e. not present in any of the drawable folders) so they will not be a part of the APK file that i provide.
Is it even possible to do such a thing in Android? Or can someone suggest a better solution that i have right now. Any help is greatly appreciated.
There is an official way to achieve what you want: APK Expansion Files
I'm developing an application that uses about 150 small HTML pages (up to 25-30kb, actively used by WebView).
My question is how to save this kind of data on Android device ?
Maybe XML or SQLite......
Thanks
Put all the pages in Assets folder. They will be packed together in the apk and access them as below:
webview.loadUrl("file:///android_asset/your_html_page.html");
You can write them at runtime into a specific directory in the sdcard (if present) and load them from it when you want...