Best Android Studio: How to Connect Android with PHP, MySQL

Все видео канала Oum Saokosal2015-11-01 14:20

Best Android Studio: Tutorial on How to Connect Android with PHP, MySQL (PhpMyAdmin) XAMPP. Recommended to Read this post to understand more about my library:

Please subscribe

To connect Android with MySQL Database, you cannot do it directly. You need a Web service as a medium. In this case, we can use PHP because in PHP you can have a single of code that easily converts database data into the JSON format. You can convert it to XML as well, but many prefers JSON due to its size and performance.

Download the lib at

Android recently changed its IDE from Eclipse-based Android Development Toolkit (ADT) to IntelliJ IDEA-based Android Studio. The big reason for that is Gradle. Gradle is a modern open source build automation system. It works better in many ways than Ant, which is used by Eclipse-based Android IDE. The change also affects some old APIs to deprecate.

In this tutorial "How to Connect Android with PHP, MySQL", l uses the new IDE, Android Studio along with the new APIs. Moreover, I created my own library that simplified the way of how to connect Android with PHP and MySQL. Before this, you had to have a private class extends AsyncTask class all the time in order to connect to the Web. The AsyncTask class works as background thread. Since Android 3.0 API 11 (Honeycombs), you are allowed to use the main thread to do a long process, such as connecting to Web. I named the lib as GenAsync.jar (Generic AsyncTask) and you can download it at My lib hides all the complexity and all you have to do to instantiate the PostResponseAsyncTask class and pass a POST data as a second argument of the constructor. You call the execute() method and provide the URL that you want to pass the data to. Finally, you can receive the data by processFinish() method. This course guides how to create a database and a table in MySQL and create PHP pages.

Check out the latest articles on Android Phone at:

Subscribe. Like. Share. Comment.

Oum Saokosal

Photo Credit:
The photo ( used in my video cover is copyright (c) by Kārlis Dambrāns ( made it available under Creative Commons (