best way to get the data from database [closed] - android

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 was designing the classified app in android which takes the data from the db hosted at run time. I have designed it and it is working fine but it is very slow as application has to fetch the data from the server and which take much time. I want to reduce the time by some way that user get the data immediate and also can get the data offline with out internet.
Can any one suggest me the best way for store the data in the mobile app or any other way?
can i create a xml and store it on user mobile?
Please let me know.
thanks in advance.
itin

One way is to do this by ContentProvider.
Another way is to use a framework like ORMLite, an Object Relational Mapping.

In my opinion you have two good methods . Fist one ;use store procedures ,triggers and functions to get data from database .Second method get data by using service like json do not use xml(soap).

Related

Database for an Android App [closed]

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 6 years ago.
Improve this question
Hey guys I'm working on an Android App with Android Studio and I need a database like mlab(mongoDB). But Android doesn't support mlab. I can't just use SQLite because my data has to be saved also when my application is not running.
For example if my user signs in, their profile photo and other information should be saved in the database and I also want to code something like a friend request which also should be saved in the database.
I googled so much but I didn't find a good solution.
I hope someone can help me.
You asking about two separate things. mLab is a Database as a Service which uses MongoDB, while SqLite is just a database.
You can save data while your application is not being used with either option, simply look into background Services and other parts of the Android API that allow background tasks.
If you want to save data to a database that is not on the device, you'll need to look into the documentation of the service to determine the best way to interact with your database. In the case of mLab, they allow both custom drivers and a REST API for interacting with your database.

Should I use sqlite? [closed]

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 8 years ago.
Improve this question
In my app i want to add a new feature that consist in having a list of object's bought by the user. So, when the user buy something he add's that object to the list. Later, if he starts the app again,there should be all the items added in the list.
The object will have some parameters (name, bought date, price, etc etc). My question is: is this a case to use sqlite?
If yes, In the activity with the list of the objects, everytime the activity starts I will have to load the table from database?
The answer to your first question is "yes". The answer to the second is, also, "yes".
Should I use sqlite?
Well, it depends on your preference and the scenario,
If you are using a webserver and updating the webserver, no need
to use a sqlite since you can ping a query to server and show the
objects for the list
If you are not using a webserver you can use Sqlite for this
scenario since you can perform all the
CRUD(Create,Read,Update,Delete) operations for the Sqlite
Advantages and disadvantages of using SQlite
Pros:
If your application gets closed the in memory data will be lost, but after that you will be able to restore the state from the database if you have one
Especially for the case of complex calculations it is good to store the result once in the database and not recalculate it multiple times on demand
The database will untie your UI from the internet connection and thus you will be able to display results even if there is not internet connection
Using database you will be able to fetch the updated data from a background service, without impacting your UI
Organizing your data in database usually makes it a lot easier to manage all the application data.
Cons:
Adding database will require a bit of additional effort on your side
Sinple Line :: Go for Sqlite solution

Access global data in iOS/Android [closed]

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 9 years ago.
Improve this question
I'm creating a website with an according app for iOS/Android and I'm doing some research for how I should do everything. I need to be able to post data from the different platforms and I want to access the same data from every platform, kind of like a wall where ypu can write stuff. I'm thinking that the data needs to be stored in a database but how do I access i.e. an SQL database from iOS/Android?
A simple research would've brought you a great tutorial on how to link a MySQL database through PHP to an Android app.
You'll be required the basics of PHP though so you may want to study a bit about that prior to starting.
Take a look at parse.com. This likely provides what you need without having to set up server with a database, etc. You can access your data on parse.com from iOS, Android, your web site, and a number of other platforms should you need to.

Storing data on Android for offline access [closed]

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 9 years ago.
Improve this question
what are the best practices to save content data when the device is offline or when you have already downloaded some content that shouldn't be retrieved from server again?
Is SQLite the best approach to achieve this? If the information that I want to store is retrieved from an API as a JSON should I create a database structure to parse and insert it?
I know that the above are different questions but the purpose is the same.
Using Sqlite is a bad idea as it is extremely slow and takes up a lot of unnecessary space. When possible serializing objects or using SharedPreferences should be prepared to sqlite (unless of course you have a database structure). For caching and storing data pulled from the internet, I recommend robospice: https://github.com/octo-online/robospice. It's a very well done library, easy to use, and should be used any time you download data from the internet or have a long-running task.
I would say that it depends on the type of data you're saving. Sqlite is not always a bad idea. It's slower than storing an array in memory, but if you're handling a 500-entry address book an array is going to be a lot more clunky than a database.
Robospice looks interesting.

How to create a searchable list [closed]

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/

Categories

Resources