Lectura y escritura de SQLite / JSON desde una aplicación de Android [cerrado]

I am looking for some assistance. Long story short, I have most of my UI done for an Android app. That being said, I want to read questions (strings) from a web-based server to populate the app, rather than a local database. Essentially, I want to be able to add items to my web database and have the Android app query it to retrieve new questions, as well as submit responses. It turns out, the SQLite aspect is a bit over my head.

So I'm looking for two things: help with deploying a local SQLlite db that I can query and write to for now, that once I am done testing, I will deploy on a web server for anyone who downloads the app to utilize. Obviously all the writing and querying will be invisible to the user, but I need to code it in anyways. And then the second aspect will be the actual accessing of the db in Android via code. So far I've pulled off downloading text and images from webpages without too much trouble.

In terms of what I have done, I have downloaded SQLite Database Browser from Sourceforge and made a local db, but I can't determine how to access it via Android or to make it a locally hosted, rather than just local db.

I don't necessarily need code from anyone directly, I am just having trouble finding a good tutorial/guide that applies to my circumstances well. Any suggestions?

Edit: Someone on another server just said this: "SQLite is not a suitable choice for this, it's typically meant for being embedded in an application. Have a look at MySQL or PostgreSQL."

So, if anyone knows of the same type tutorials for MySQL, I'd appreciate that:

1)deploying a MySQL db onto my local machine (that I would eventually move to a webserver, even if it's just a second deployment)

2)programming an android class to query and write to said database

preguntado el 09 de marzo de 12 a las 22:03

2 Respuestas

If I was you then I would write the server using Google App Engine and use whatever data format you want to send data back to yourself. Then just read this page to learn how to start using SQLite databases inside your own app so that you can manage the data on the client side. If you become well versed in those two then you should be on good ground to build any client-server app that you like for Android devices.

respondido 09 mar '12, 23:03

I am a bit of a book learner to be honest. And for the most part, what I have learned in Android so far, has been from two books. Part of what I want to learn here, is exactly what languages and DB systems I need to know in order to get all of this up and running. Should I be getting a book on MySQL in order to learn the basics that I am going to actually need in order to complete my project? - Davek804

If you really want to get a book then you can. But I would suggest that you consider trying to learn from the documentation first. Just read the online guides meant to help you: code.google.com/appengine/docs As for the technology stack, sure, getting a good book to teach you about databases and SQL will come in handy. And maybe reading through a book on networking would not go astray. But the ultimate decision on how you bind the technology together will always be up to you and no book can really help you there. - Roberto Massaioli

Robert, could you take a look at my new question? Here's the link: stackoverflow.com/questions/9879448/… It has to do with NetworkOnMainThreadException. - Davek804

I used this tutorial word for word, only changing my data base user/password/address/database: http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/

Beyond that, I am now in the process of adapting the tutorial to implement ASyncTask so that I can run it on all Android devices.

respondido 30 mar '12, 07:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.