Professional Documents
Culture Documents
* Volley enables us to connect our app to the web >> android front end > api >
backend server >> api : application programme interface enables us to connect front
end to the backend server of the app
* to get volley into our app go to0 Gradle > build.gradle > add the dispencery from
the volley official website >> for now implementation
'com.android.volley:volley:1.1.1
* now click sync to sync the grade changes with the app
* whenever we use volley just add the internet permission in the android manifest
file
* json request object >> Jsonobjectrequest <name> = new
Jsonobjectrequest(Request.Method.Get<here instead of get there are so many
operations that we can perform>,<your db url>,null,new responcelistener,new
responceerrorlistener);
* to put all the data collected in a queue before creating a json request just type
in out of the main method as private RequestQueue <name>; and now in the main type
<name> = volley.newrequestqueue(this) >> now after the jason request creation type
<name of requestqueue>.add(<jsonrequestobject name>)
* JASON ARRAY : same as the creation of jasonobject request but when we want to
retrieve data since it is an array we need to create their individual objects so to
do that
just in the responce listener type >> for(int i = 0 ;
i<<jasonarrayname>.lengeth ; i++){ JasonObject <object
name>=responce.getjasonobject(i) } now we get an error and can be resolved by
using try and catch fix.....now if we want to use them just type
responce.getString("<key id as in the json array in the web>")
*