How to store images in android? - android

I am trying to develop an app on android using xamarin.
i just wanted to know where to store images.I mean which way is better, should i store images in DB or in a separate folder.
which one is better?
I was talking about images of products. for example:- i downloaded the ebay app today. app is very small in terms of size. but ebay has loads of images of the products.
Please explain.

Store your files in the folder name returned by this:
Environment.GetFolderPath(Environment.SpecialFolder.Personal)
It will return the local folder of your app in internal storage:
/data/data/#PACKAGE_NAME#/files

Store them in Resource folders (build action AndroidResource) as described in the Xamarin.Droid docs.
Make different sizes of your image for different screen-densities and store them in seperate folders as described in the Android developer documentation.

Related

Android App Viewing Images Uploaded on Cloud Storage

I have a catalog Android App that I am building to showcase different catalogs from different local stores. The Catalogues are basically pages in Image(JPG) format. I would like each store to have its own activity that launches a catalog.
From my research, I can achieve this by creating a storage reference to a storage bucket that holds these images on google cloud storage. I have created one storage bucket that is holding about 8 images of a catalog. I am not sure how to implement this connection to my app.
What would be the best way to go about this? Should I create a tabbed activity for the images to be swiped through and if so, how is this created and referenced to the images from the android studio?
Any help or resource on this would be highly appreciated.
I have already connected the App to firebase which is working fine.
I have the activity_main.xml layout file with all stores and upon clicking on a store the idea is to launch the catalog images for that particular store.
Please help!
You can see Firebase storage quickstart which can give you an idea on how to setup your app. For displaying images, it would be easier if you use Firebase UI, here's a link to the related documentation.
EDIT:
By the way, you are in the right track of setting different references to your buckets.

how i can store image from UWP application and get on android app ? (using sqlite or something else)

I am getting images from a webcam and want to store it in a database, and user get this stored image on his/her android app.
please tell me a way to do that. Thanks
In my opinion it's not a good way to consider using SQLite to save images directly, the recommended way is to save the image paths. Since you don't have a server to saving images for different platforms, I recommend you to use cloud storages to save the image sources such as OneDrive and Azure Storage. OneDrive for personal may be free.
If you are choosing to use OneDrive, you can use the Graph APIs to access the images in OneDrive, and which is supported in UWP as well as the Andriod platform. For Graph samples and SDK for UWP and Andriod please reference this.

Path in the server to store images

I'm designing a DB. in the DB, there is a field that stores the link to images.
Where in the server should these images be added? Should it be in public_html? These images will be used in the Android app.
In most cases the images are saved in a specific directory for them. For example:
.../images_stored/
Although it is for android pictures, I imagine that also can be accessed from ios or another OS, for example instagram images are for any (Android / iOS / Web) operating system.

How to supply images with Android application

I need to make an application, which will be a gallery of several pictures, supplied with the application when downloading app from Play store.
Could you suggest how this is best done in the future to facilitate the addition of new images?
I know how to do to gallery took the images from a folder on your device, but how to put these images together with the application from Play Store? We need them as a resource to unpack?
Thank you!
You have 2 basic options.
Download images from internet on runtime - supplied by your server which you can control and therefore add new images without the need of updating the application.
Or you can just put images into your /drawable folder within app and every time you add new image there you update your app on play store.
if you put all the image in the drawable folder then the application is going to be very big. I would suggest putting the images on a image hosting cdn like cloudinary then use an image downloader to pick the images from the url and cache them on the device like Picasso or Universal Image Loader. Also you dont want to be shipping updates just because you want to add a few images.
I think there are 2 ways to do it:
(1) Put the pictures to web server. The apps can download the new picture from web server and store to device's local memory.
(2) Put the images to /Asset folder and submit app update to Google Play when you want to add more pictures to the Apps.
I'm not sure what you mean as a resource to unpack, but the simplest option is to include them as drawables.
If you do not want to do that, you can include them in the assets or raw resources directories. Assets is often used for some images raw might be used if you were for instance including some other format to unpack as you said, bit that comes with its own issues.

Storing lots of small web pages on Android

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...

Categories

Resources