How to Connect Android with PHP and MySQL? Volley Tutorial (Part 1)

How to Connect Android with PHP and MySQL? Volley Tutorial (Part 1)
How to Connect Android with PHP and MySQL? Volley Tutorial (Part 1) worked on any Android Phone. Please subscribe https://youtube.com/oumsaokosal?sub_confirmation=1

Android Volley Tutorial (Android PHP MySQL) - How to Setup Volley Library (Part 1)
In this series of Android Volley Tutorial, you will learn how to set up Android Volley library in Android Studio. Because there is not built-in Android Volley library for you, you have to go into Android tutorial site and copy and paste some of there gradle and code.

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 DOWNLOAD LINK: http://bit.ly/2f5vHcU


Part 2 is at https://www.youtube.com/watch?v=UBqBtCI9xes
Part 3 is at https://www.youtube.com/watch?v=B8MBLX5wh18

Playlist at https://www.youtube.com/playlist?list=PL0DVoqvV_Tdhv5SziqTgGTBBsg2Mu6XvF

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.

In this video, you will learn the basic of volley library and how to install it. Also you will learn to create a singleton class for RequestQueue and make string requests to retrieve data from the web.

Check out the latest articles on Android Phone at:

Photo Credit:
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/).

Below is the transcript:
Hello everyone, my name is Oum Saokosal
Today we talk about how to make android with PHP and my app using Volley. This is where you can find me. You can find me on YouTube, Facebook, Twitter and GitHub. I will make four videos about android volley. The first part is about volley library singleton and RequestQueue. The second one is about how to send and read data from PHP and my SQL. Part 3 I will talk about how to convert data into JSON and send it to the custom List view. PART 4  I will talk about how to send images to server.
So Android Volley is about to do multitasking. In early version of Android, you could just do multitasking on a main thread but you got a lot of problems like a memory leak. Sometimes you have to wait a task to be completed on a main thread for very long time. Then Android 3.0 to use another library or acting power.
So. That was good. That was enough for many applications. But still axing task is just asynchronous until task A complete. Task B has to wait something like this until you hit the floor. You have to wait in the air something like in in the picture here.
It's also a first in first out. Something like in the queue.The waiter has to complete a person task. Then and then the next can come. So what if you have a long queue like this.
Then android in the use volley library. People confuse volley library is something like a bouncing ball like a volleyball. It's not it's not a volleyball. Volley mean something different in English is something like you shoot arrows in the air at the same time and you end up shooting one arrow. You have many people shooting arrows at the same time. This is what volley look like.
Okay OK let's go to Google. We will type android volley library you will see the first one from Android. There is a good lesson about this and you can read it but first I want to show you about how to set it up.
So. Android is a part of android open source project so you can clone the project and use it for free. Or if you don't want to do it yourself. Maybe you just use this one. The second link you go here. But he said that his library is deprecated.

RRelated Posts

Android Volley User Registration App

This video gives detailed development of an android user registration application thereby handling the backend using PHP and Mysql and also developing the front end interface with the Android Java


  • Evo Sal
    Thanks bro!!!
  • Berna EM
    Hi estimated, thank for the video, very helpful, i am intent do the same example but inside the fragment, but have several errors, please, you can show in a simple example how connect volley in a fragment o if you have a tutorial o web page where i can learn it.
    thanks in advance for your replay.
    mi email is: jbernibe@gmail.com
  • Your Style [Official Channel]
    Thank you for making these video
  • Ali Derrouich
    when i set a local url it gives me erreur but when i typed it in the enumilateur browser it works , i dont understand it would not display the result in the android Monitor , please help
  • Ali Derrouich
    please i did every step in the video but i dont have the same result , this is what i have in my log ali :(08-01 16:46:29.939 3931-3931/com.example.omen.test D/ali: <!doctype html><html lang="en"> <head> <meta content="width=device-width,minimum-scale=1.0" name="viewport"><meta content="telephone=no" name="format-detection"><meta content="address=no" name="format-detection"> <title>Google</title> <style>._wtf{display:inline-block;fill:currentColor;height:24px;line-height:24px;position:relative;width:24px}._wtf svg{display:block;height:100%;width:100%}</style> <style>.hp #sfcnt{margin:8px;margin-top:160px}.srp #sfcnt{background:#fff;height:35px;padding-bottom:6px;padding-right:8px;padding-top:7px;border-bottom:1px solid #E5E5E5;padding-left:8px}.no_outline a,.no_outline div{outline:none;}.msb{position:relative}.srp .msb{top:1px}.msfo{padding-right:38px}.msfi{background-color:#fff !important;border-color:#c7d6f7;border-style:solid;border-width:2px 1px 2px 2px;border-right:none;padding:0;height:38px;padding-right:0;border:1px solid #d9d9d9 !important;border-right:none !important;border-top:1px solid silver !important;}.srp .msfo{overflow:hidden}form#tsf{margin-left:auto;margin-right:auto;max-width:736px;overflow:hidden;width:auto}.hp .msfi{margin-top:-1px}.sb_ifc{display:-webkit-box;display:-webkit-flex;display:flex;padding:5px 0}.sb_chc{display:-webkit-box;-webkit-box-ordinal-group:1;-webkit-order:1;order:1;-webkit-box-flex:0;flex:0 0 auto;margin:-5px 0}.lst.lst-tbb{appearance:none;tap-highlight-color:rgba(0,0,0,0);display:-webkit-box;-webkit-box-ordinal-group:2;-webkit-order:2;order:2;-webkit-box-flex:1;-webkit-flex:1 0;flex:1 0;padding-left:8px}.sb_ifc[dir='rtl'] .lst{padding-left:0;padding-right:8px}.msfi input[type="search"]::search-cancel-button{appearance:none}.msff{background-color:#d5ddf3;padding:4px 5px 0 5px}.gsst_b{display:-webkit-box;-webkit-box-ordinal-group:3;-webkit-order:3;order:3;-webkit-box-flex:0;flex:0 0 28px;width:28px;user-select:none;text-align:center;white-space:nowrap}.gsst_a{cursor:pointer;text-decoration:none !important}.sbcb_a{color:#a1b9ed;cursor:pointer;font:27px/25px arial,sans-serif}.sbico{background:url(/images/nav_logo242_hr.png) no-repeat -107px -55px;background-size:167px;height:24px;margin:auto;width:24px}#mlogo{background:url(/images/branding/searchlogo/1x/googlelogo_mobile_tier1_srp_color_75x26dp.png) no-repeat;background-size:75px 26px;color:transparent;height:26px;left:9px;position:absolute;text-align:center;top:5px;width:75px}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-resolution:192dpi){#mlogo{background-image:url(/images/branding/searchlogo/2x/googlelogo_mobile_tier1_srp_color_75x26dp.png)}}#mlogo.doodle{background-image:none;height:37px;line-height:34px;top:0;outline:none}#mdlogo{max-height:64px;max-width:100%;vertical-align:middle}.ddlx-closed #mdlogo{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.ddlx-closed #lglogo,.ddlx-closed #ddlx-share-button{opacity:0;-webkit-transform:translate3d(0,-90px,0);transform:translate3d(0,-90px,0)}.ddlx-expanded #mdlogo{opacity:0;-webkit-transform:translate3d(0,40px,0);transform:translate3d(0,40px,0)}.ddlx-expanded #lglogo,.ddlx-expanded #ddlx-share-button{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}#ddlxsharemenu{background-color:#fff;border-radius:2px;box-shadow:0 2px 1px rgba(0,0,0,0.1),0 0 1px rgba(0,0,0,0.1);color:rgba(0,0,0,0.87);font-size:16px;opacity:0;position:absolute;right:8px;text-align:left;top:8px;transform:translate3d(0px,-200px,0px);-webkit-transform:translate3d(0px,-200px,0px);width:200px;z-index:105}#ddlxsharemenu.ddlx-expanded-share{opacity:1;-webkit-transform:translate3d(0px,0px,0px);transform:translate3d(0px,0px,0px)}._lii{background-size:72px 24px;border-radius:3px;bottom:2px;display:inline-block;height:24px;position:relative;margin:12px 16px;vertical-align:middle;width:24px}._Jii{background-color:#dd4b39}._Iii{background-color:#3b579d;background-position:-24px 0}._Kii{background-color:#55acee;background-position:-48px 0}#mlogob{background-color:transparent;height:36px;left:73px;position:absolute;top:0;width:23px;z-index:1}.msfe #mlogob{display:none}.srp) and when i make a local url i have nothing please i need help
  • Ruma Jreij
    Thank you! :)
  • Troy
    Sir , very good tutorial, could you plz answer my question, in case my App pull the data from a table and display it in listview, the data in this table will change 40 times per a day, I need a listener to listen to these changes and update the data in listview, can we implement that with Volley Library or other library
  • Troy
    Sir , very good tutorial, could you plz answer my question, in case my App pull the data from a table and display it in listview, the data in this table will change 40 times per a day, I need a listener to listen to these changes and update the data in listview, can we implement that with Volley Library
  • faisal nasution
    i can't find the php file in desc
  • muhammad amrullah
    sir, for real phone, what the address for localhost ??
    now, is running for android emulator, but not running for the real phone.
  • Samii
    Sir i ma new to android and want to learan web services and android studio id plx sir recomend me some type of tutorail i fell so confuxe plx help me sir
  • saket marwad
    hello sir, very helpful tutorial. but im having a problem while sending the data .It says timeout error even after using retry policy . it would be great if you suggest me a way out ..
  • Arash Sedaghat
    you always solve my problems . you deserve the money they give you . or if they don't . they have to give . and give more !! i mean really . you are an expert .
  • lifehackzz
    sir,is XAMPP safe for stroing password like stuffs..
  • bunchheang peng
    Hi cher could you make videoes tutorial about Search data use
    Volley with mySQL?
  • Dang Quach Kim
    thank you dude your are good teacher
  • Nagendra Babu
    Hi its really helpful, you have cleared my lot of doubts
  • alex629z
    If i am using a raspberry pi 2 as a lamp server, instead of hostname I can use the local IP address of the raspberry pi correct?
  • Sokha Video9
    u should speak khmer
  • Long Giang
    Please give me your php ... I need it !
  • Khmer Song smey
    មិនយាយ​ខ្មែរផង បង
  • V1
    Hi, I got this doubt: isn't it better to use Firebase instead of PHP and Mysql?
  • Aarya Manandhar
    Thank you for the awesome tutorials :)

    i have a question though:
    what IP address should i use if i am running the app on an android device?
  • All Sports
  • Edward Lance Lorilla LAB
    any tutorial using retrofit api?