Best Tutorial on How to Connect Android with PHP and MySQL using Volley (Part 2) worked on any Android Phone. Please subscribe https://youtube.com/oumsaokosal?sub_confirmation=1
Android Volley Tutorial (Android PHP MySQL) – JSON, Custom Adapter (Part 3). In this part of this series Android Volley Tutorial, firstly I will start from PHP and MySQL. You first need to have a database and a table and of course some records too. Then write some PHP code to get a connection and read the data from the table. Once you get the data, you can use json_encode function to encode the array data into json objects.
Please note that this tutorial may work on your older Samsung Galaxy, LG, Oppo, Huawei, Sony or Nokia Android phones which run Android Operating Systems depended on their API version.
Source Code: http://bit.ly/2xZnhHL
Part 1 is at https://www.youtube.com/watch?v=OaWm0jORpKs
Part 2 at https://www.youtube.com/watch?v=UBqBtCI9xes
Part 3 is at https://www.youtube.com/watch?v=B8MBLX5wh18
Part 4.1 is at https://www.youtube.com/watch?v=o1sMaD2yyXA
Part 4.2 is at https://www.youtube.com/watch?v=7itJq7Ehu_8
Secondly, I will teach you how to read the Json objects by using Volley and convert it into ArrayList by using my own library KGJsonConverter from github.com/kosalgeek
Lastly, I will teach you how to use Fundapter from github.com/amigold to bind data into a custom ArrayAdapter and set it into a ListView. Plus use Picasso to display a nice image in the ListView.
In Android, connecting android with PHP & MySQL is not always easy. In the early version of Android (before Android 3.0 API 11), you could connect to network in the main thread. However, it caused tremendous problems including memory leaks and ANR.
Since Android 3.0 API 11, Android released a library called AsyncTask which let you run the networking connection in a separate thread. I made a generic library for that which you can find at at https://github.com/kosalgeek/generic_asynctask_v2 and many video tutorials about it such as https://www.youtube.com/watch?v=e4eFBQmWs8Q
However, the library was not enough because it followed the First In First Out (FIFO) rule. What if you had a long queues of tasks to be completed at the same time? Therefore Android just released Volley in Google I/O 2013. It is a promised to overcome the FIFO and became a real library for multitasking. It is faster and cached everything.
Where to find me:
Tweets by okosal
The photo (https://www.flickr.com/photos/12982973@N04/25575823175) used in my video cover is copyright (c) by 王馬文 (https://www.flickr.com/photos/12982973@N04) made it available under Creative Commons (https://creativecommons.org/licenses/by/2.0/).