How can I save many sentences efficiently in Android? - android

I am developing an app for Android which will have many sentences organized with categories. Besides, this app must upgrade the sentences with a mysql database.
My question is: How can I save many sentences efficiently?
I have thought creating a sqlite database in my pc and add it to the app project. Is that possible?
Maybe, could I do another thing?

Like you said; create your database using sqlite on desktop and then include it in your application in the \assets folder. Use it normally in your application.
Remember to always us _id as the primary key in your tables.
For more details check this blog post

Related

How to store Data for my application

I'm really new to programming apps - so this question might sound a bit strange:
I'm trying to program an app in android studio, where people can upload different things (basically strings and links put together in some kind of "package") and other peoble can then decide what "packages" they want to add inside their app. However after downloading, this data should be stored on their device and not just in the memory of the phone so that they can use it after restarting the app (and also if theres no internet connection). Do you have any idea what would be the best way to store this data both on the phone and in a database and how to synchronize the data on the phone with the selected data from the database. I really dont want to know how to do this exactly but would rather like some basic ideas and maybe you could tell me what kinds of stuff i should learn in order to succeed and what kind of database would be best here (firebase, MYSQL,..)?
Thanks a lot,
Andi
First of all you should decide what DB you are going to use.
In my opinion all RDBMs are good, but using Sqlite in order to achieve best performance on android devices is a good idea.
In your case you need server-side DB and application too.
(Depend on the scenario and framework you use can be different (sql,mysql,PostgreSQL,oracle,...)).
About how to sync local database with server-side you can download new DB from server and replace it with previous one, if you need previous user data you can have 2 different table and update one by downloading it from server, and save id or any identical row from specific package that already saved by user.
These are some question has been already answered in Stackoverflow
java - How to update table in sqlite?
java - SQLite in Android How to update a specific row
Create SQLite database in android
If you are talking about local databases. Go for Realm or look up a good ORM on github (Object relational mapping, you dont have to write SQL queries explicitly) .
I would suggest Realm which is very fast and user friendly.

How I can make a Sqlite Database in PC for use in my app?

Sorry for my english, i'm trying to improve it.
Im new in the Android develpment world but i know the basics.
My question is, How I can make a Sqlite Database in my PC for use in my app?
For example: I would like to make a table whit many names, second names, adress, and fill those field in my pc for before use that database in my app for find my contacts, for example. I want to make something like this for another purpose.
Where should I start?
Where should I start?
I am interpreting your question as meaning that you want to:
Create a SQLite database on your PC
Package that database with your app and use it as the starting point for a database on the device
There are many clients for SQLite, including the command-line sqlite3, the SQLite Manager add-on for Firefox, and many others. You can use these to create the SQLite database on your PC.
Then, use SQLiteAssetHelper to package the database with your app.
For a 2015 answer, the one that I use is called DB Browser for SQLite: http://sqlitebrowser.org/
It allows you to create a SQLite Database similarly to how you would create an excel document with rows and tables.

Best to store dynamic data and dynamic things in android

the scenario is that -- in my application client would make dynamic edit text (of which i m not sure ), but i want to store all the information he creates. All other part have been done.
I just want to know which is the best way to store them in File OR in Database.
As if some says in Database, i want to know how?
and if in File, why?
I will encrypt and decry pt the data too.
Any help would be appreciable.
Thanks in advance.
Store the data in a database. If you're doing Android development, simply use SQLite - http://www.sqlite.org/.
There are many reasons not to store the data on the file system:
It is easier to query a database than a file system. You can quickly and easily answer questions like "How many records do I have?" or "How many items in a given category do I have?"
If you do this in the file system, you'll have to write your own code around querying.
SQLite has strong data types that enforce a schema. If you just write to a file, you'll have to ensure an ID is an integer etc. The database can do this for you.
From my experience when writing files to the file system, I've always ended up with orphaned files. You write them and then forget they are there and they never get deleted. It's annoying. With a database you can easily assess the state of the database and remove old/unused records.

help needed for developing an android glossary application

I am developing a glossary of terms in physics. In this glossary app, user can search the definition alphabetically as well as by category . Shall i store data in one table or create different table for different categories? which will be better. I want to develop something like this app https://market.android.com/details?id=com.beiks.bd_1119_NurserySongs_FULL but with images to explain it better. Shall i store the images also in database? Is there any way to use pdf files to display? Sample app with code will really be helpful. thanks in adv.
Shall i store data in one table or create different table for different categories?
I would suggest spending some time creating a normalized database structure, instead of splitting it into separate tables. For example, if you think you might assign one entry to multiple categories, that would call for a very different table schema (categories table, definitions table, and a definition_categories linking table that references the first two). If you don't need that, then having a single definitions table with a category column would be sufficient.
Shall i store the images also in database?
If you'll be shipping the application with the images included, then do not store them in the database -- the reason is because then you'll be using up twice the space for your images (once in the application resources, and once in the database).
If you'll be downloading the images from the Internet, it really comes down to personal preference.. The easy way would be to just download the images and store in your data directory, or on the SD card ("external storage").
Is there any way to use pdf files to display?
That depends on the device, and if it has a PDF reader installed. You can test for the existence of a PDF-capable application on the device using techniques described in this question.

Alternative to using relationship with SQLite

I'm creating an app which is going to have some data that is stored in an SQLite database. I want the user to be able to create "folders" which can be assigned to each data item.
I was going to do this using a one to many relationship e.g. one "folder" can have many data objects under it but having looked at relationships with SQLite and Android it seems that this would only work in 2.2+ so I'm just wondering what the alternative is?
Any information is much appreciated.
You can still have relationships; older versions of SQLite just won't enforce them. As a stopgap, you can build triggers to do it; in fact there's a handy generator that will generate the SQL for you to use as a starting point.

Categories

Resources