How can I connect MySQL and Android? I have MySQL db in remote I want get the values from that database and display those content in Androidlist view. I have tried many web se开发者_运维百科rvice samples, but I have met some problems.
I have tried this using json and php from this link http://blog.sptechnolab.com/2011/02/10/android/android-connecting-to-mysql-using-php/ , but my app quits
There is no JDBC driver for android / MySQL. So you can't connect to your database as a desktop application or a web server would.
You then have to write a small interface, typically a web server to make your mysql data available, and then write a small android client, usually parsing xml stuff from your server.
That's the way to go, the very big picture, but your question is vast and fuzzy, that's the best answer I can give you.
There are various way to access mysql database from android.
You can access data from web services for ksoap2-android lib is good fro that. Click for web services example web-services example
You can also use Http connection or socket programming.
This have been repeatedly in SO, here a i leave you with some samples
SO
- Connect MySQL database from Android
- Get data to android app from mysql server
- How to connect to a MySQL Database from an Android App?
- android remote database connection trouble
- mysql db connection
- Connect MySQL database from Android
And also in other places,
AndDev
- [TUTORIAL] Connecting to MySQL database
- HELP with a Tutorial for connection using MySql
More
But wait there is more :D, on google
精彩评论