Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
116 views
in Technique[技术] by (71.8m points)

java - Connecting to external database - Android application

I am writing an application for my third year project. The application will require interaction with an external mySQL database. The application will retrieve data from the database and display it to the user in a ListView.

I have a good idea of what sort of functionality the application is going to have. I also have spent a lot of time working with ListViews and the local SQLite database. I also did a bit of reserach into the HttpUrlConnection class.

I am just wondering would anyone be able to offer me a little bit more guidance as to how I might go about accessing this external database?

Will it involve me having to write a web service to handle the transactions? and if so what would that involve as I have not encountered web services in my course just yet.

Any advice would be much appreciated. Also my application is intended for use on ICS v4.0.4.

Thanks everyone!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Yes you have to create Web Service to interact with External Database (MySql in your case). Its very easy to create Web service in PHP as its having one function which convert your DB data to JSON and you can easily parse the JSON data and display that in Listview or accordingly your requirement.

Here are some useful link which will help you to get more details :-

http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ - Best from All

http://www.coderzheaven.com/2011/04/08/android-phpmysql-connection/

http://blog.sptechnolab.com/2011/02/10/android/android-connecting-to-mysql-using-php/

Hope it helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...