Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am doing a simple app where I take a picture, fill some text from the UI and store the image + text together.
Eventually the user can select the picture from a recyclerview and edit the associated text (or delete the whole image + text group).
I have no hint on what kind of data structure should be used.
I heard that SQL lite should be used for such tasks - since the text data could change according to the user actions, but I think that using tables (one or more) for the purpose of storing images and text could be overkill - also because I don't expect to have a lot of images in my app.
I'm wondering if any other data structure is available for this purpose (similar to C strctures, or python dictionaries).
Also, any kind of hint about keyword to search for this topic or resource would be really appreciated.
Just for the sake of discussion, I am developing using kotlin.
For storing images, you should store them as files, and store file paths of those images in the database with text. Moreover, when you read it back you can use Picasso or Glide to load those image paths into ImageView.
Also, if you want to store images in external storage, make you request runtime-permission and add permission to the manifest file.
However, if you store files in internal storage, you don't need to request permission.
Learn more about Runtime-Permission and Storage in Android.
I would suggest use Room for working with SQLite in Android.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
this is the first time that I need to store some data permanently so I would like some suggestions before to proceed. I've read that there are different ways to store data on an Android device:
Internal storage
Shared Preference (but if I've understood is just for symple data like an option)
Shared storage (but I don't need to share data among other apps)
Database
I can't understand what is the best option for me between the first and the last.
My case
I have a list of book with title, subtitle, cover image and each book contains a list of cards with title, optional image, (audio if possible), other stuff.
So, I have to store an arraylist of a custom class that includes another arraylist of anothercustomclass and some text/image
Which approach should I take?
Thanks
Frankly, the case description is much too limited to give an informed advice (so the question should be closed).
But if you have doubts, then the safe / default choice is the database. It might come with big overhead for some cases (like when it's enough to serialize the whole arraylist to a blob and store as a single file), but you are less likely to paint yourself into a corner.
Addition (after a comment)
When using a database, you don't store objects directly (because what an sql database stores are "relations" which you can think of as "sets of rows", not objects). Instead you have some code (custom or from a library) that translates an object into a row (or multiple rows) for storage and some code that translates it the other way.
If you want to store the actual objects, then serialization to a file is pretty much the only way.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a lot of String code values that come from server, and I want to translate this codes to strings.
I can get key and value (code : string) from server every week and store/update them.
What is the best way to store, update, and read/use this data, over whole activities of app?
Thanks.
You have the following alternatives:
Shared Preferences - a persistent key value store. You can write values, that are stored to files, that are accessible in the app context.
Database - use the built-in SQLite instance or a third party DB of your choice. The data is persisted and also accessible from within the app context. Extracting the values may be a bit over complex for your case.
Plain files in a custom format that fits your use case - you can create and store files that are private to your app and store and extract info from them. You will have to deal with the file format and operations in a custom way.
As a whole, fetching your string resources from the network is not a very good approach. In this way you have to deal with localisation and internationalisation in a custom way and can't use the built-in goodies provided by the Android OS.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I want to design an App to display short stories and images belong to this story.
I think I have two scenarios:
a- save the data in SQLite and attached with the app.
b- save images in a drawable folder.
(But the App size will be big because of the images saved in drawable folder)
save data and images on server and App pull the data.
My questions:
1: Which is the best scenario 1 or 2?
2: in case I choose the scenario -2- is possible to use firebase, like I want to put the data and images on the firebase and just the apps are authorized to pull these data?
3: Any new scenario for best practice to achieve that?
I choose second one.
We can include dynamic content.
Small APK size.
If new story comes, no update to your App. the existing app will show the new story.
Not only one include thousands, lacks, millions oru trillions
Firebase is currently Available best option. Only the difficulty is designing the data storing in the firebase. And you can fetch dynamically or first time. and Fcm push notification, you can include if you insert new stories.
For image you can use different libraries.Fresco, Glide, Picasso
And Another option is Designing your own server. It include other programming knowledge and a host also
But fcm free pack only 100 connections are allowed at a time.
Choose Firebase.
This will give you the flexibility to update the content (Images/Stories) remotely. Firebase Database you can use to store the text data and Firebase Storage to store the media files.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am starting with a new app i which i will be needing web services.All the data will be coming from the data base.My database will look something like this
Id
Name(Birds Name)
Description
Date
Image for that Name
Now i want to give all the values to user in json array.But i am confused on few points
How will i send images in json array
Is it correct to store Images in Database?
There may be 3-5 images for a particular name,so do i create a different table for images with foreign key??
P.S-Also it would be grateful if some one can give me link on how to make a web-service which i can consume in my android application
To answer your questions:-
To send images in JSON Array, you need to convert your images into BASE64 first and then add it in your JSON Array object. This BASE64 type can be received on the webserver and a reverse operation could be performed to get the actual image.
NO. Images are never stored in Database. Rather store their corresponding path. Its always better to save images on the external storage.
Yes. You can create a separate table, but to store the path of images, not the images itself. You can then use foreign key to acces the images path and then the images respectively.
Regarding the techno, I use Google App Engine + Endpoints. A good choice, because endpoints generate with Maven the model for the Android app based on your AppEngine datastore.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I would like to have a database of items stored on the user's phone. I currently have everything set up using WebView pointed at my domain, but obviously this isn't ideal if the user is in a low-signal location.
If possible I would also like to be able to search the list for multiple words.
Any pointers to tutorials etc would be ideal.
In Android you'll want to use SQLite databases, here are some places from where I learned my way with databases in Android:
Start here:
http://www.codeproject.com/Articles/119293/Using-SQLite-Database-with-Android
Or here if you want to use an existing database:
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
If you decide on XML, though, you might want to read this instead:
http://www.anddev.org/parsing_xml_from_the_net_-_using_the_saxparser-t353.html
http://www.androidpeople.com/android-xml-parsing-tutorial-using-saxparser
Here you have a tutorial involving both methods, downloading data in XML format, parsing it and storing the information on a database, probably the guide you want to read if you're starting with Android, since it covers pretty much what you are trying to achieve, probably :P
http://mobile.tutsplus.com/tutorials/android/android-fundamentals-downloading-data-with-services/