SlideShare a Scribd company logo
Transmitting Network
Data Using Volley
14/September/2016 – 20/September/2016
Prepared by: Ms. Sokngim Sa
Content
1. Introduction Volley
2. Benefit of Volley
3. Sending a Simple Request
4. Setting Up a RequestQueue
5. Using ImageLoader
6. Using Request JSON
7. Implementing a Custom Request
Using RequestString
1. Introduction Volley
Volley is an HTTP library that makes networking for
Android apps easier and most importantly, faster.
Using Volley in your Project:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.volley:volley:1.0.0'
}
2. Benefit of Volley
 Automatic scheduling of network requests.
 Multiple concurrent network connections.
 Transparent disk and memory response caching with standard
HTTP cache coherence.
 Support for request prioritization.
 Cancellation request API. You can cancel a single request, or you
can set blocks or scopes of requests to cancel.
 Ease of customization, for example, for retry and backoff.
 Strong ordering that makes it easy to correctly populate your UI
with data fetched asynchronously from the network.
 Debugging and tracing tools.
3. Sending a Simple Request
 Add the Internet permission
 Use newRequestQueue
 Send a RequestQueue
 Cancel a Request
2.1 Add the Internet Permission
 Add android.permission.INTERNET permission to app's
manifest
<uses-permission android:name="android.permission.INTERNET/>
2.2 Use newRequestQueue
 Volley provides a convenience method
Volley.newRequestQueue that sets up a RequestQueue for
you, using default values, and starts the queue.
// Instantiate the RequestQueue.
RequestQueue queue = Volley.newRequestQueue(this);
2.3 Send a Request
 To send a request, you simply construct one and add it to
the RequestQueue object with add(StringRequest Object).
// Add the request to the RequestQueue.
queue.add(stringRequest);
Processing Send a Request
Example of RequestQueue and
Send Request
2.4 Cancel a Request
 To cancel a request, call cancelAll()on your Request object.
 We can call cancel a request in onStop() method of An
activtiy
mRequestQueue.cancelAll(Object Tag);
@Override
protected void onStop () {
super.onStop();
if (mRequestQueue != null) {
mRequestQueue.cancelAll(TAG);
}
}
Example
 Define your tag and add it to your requests.
Example (Con)
 In your activity's onStop() method, cancel all requests that
have this tag.
3. Setting up a RequestQueue
 Set Up a Network and Cache
 Use a Singleton Pattern
3.1 Set Up a Network and
Cache
 A RequestQueue needs two things to do its job: a network
to perform transport of the requests, and a cache to handle
caching.
 There are standard implementations of these available in
the Volley toolbox:
 DiskBasedCache provides a one-file-per-response cache with
an in-memory index
 BasicNetwork provides a network transport based on your
preferred HTTP client.
 BasicNetwork is Volley's default network implementation. A
BasicNetwork must be initialized with the HTTP client your
app is using to connect to the network. Typically this is an
HttpURLConnection.
E
x
a
m
p
l
e
Note
 If you just need to make a one-time request and don't want
to leave the thread pool around, you can create the
RequestQueue wherever you need it and call stop() on the
RequestQueue once your response or error has come back.
 using the Volley.newRequestQueue() method described
in Sending a Simple Request.
 But the more common use case is to create the
RequestQueue as a singleton to keep it running for the
lifetime of your app.
3.2 Use a Singleton Pattern
 If your application makes constant use of the network, it's
probably most efficient to set up a single instance of
RequestQueue that will last the lifetime of your app. The
recommended approach is to implement a singleton class
that encapsulates RequestQueue and other Volley
functionality.
 Another approach is to subclass Application and set up the
RequestQueue in Application.onCreate(). A key concept is
that the RequestQueue must be instantiated with the
Application context, not an Activity context. This ensures
that the RequestQueue will last for the lifetime of your app,
instead of being recreated every time the activity is
recreated (for example, when the user rotates the device).
Create Singleton Class
In MainActivity
4. Making a Standard Request
 Introduction to Standard Request
 Request an Image
 Use ImageRequest
 Use ImageLoader and NetworkImageView
 Request JSON
4.1 Introduction to Standard
Request
 StringRequest: Specify a URL and receive a raw string in
response.
 ImageRequest: Specify a URL and receive an image in
response.
 JsonObjectRequest and JsonArrayRequest (both
subclasses of JsonRequest): Specify a URL and get a JSON
object or array (respectively) in response.
4.2 Request an Image
 Volley offers the following classes for requesting images.
These classes layer on top of each other to offer different
levels of support for processing images:
 ImageRequest—a canned request for getting an image at a
given URL and calling back with a decoded bitmap. It also
provides convenience features like specifying a size to resize
to.
 ImageLoader—a helper class that handles loading and
caching images from remote URLs. ImageLoader is a an
orchestrator for large numbers of ImageRequests, for example
when putting multiple thumbnails in a ListView.
 NetworkImageView—builds on ImageLoader and effectively
replaces ImageView for situations where your image is being
fetched over the network via URL. NetworkImageView also
manages canceling pending requests if the view is detached
from the hierarchy.
4.3 Use ImageRequest
 Create Singleton Class
 MainActivity.java
 Main_activity.xml
4.3.1 Create Singleton Class
4.3.1 Create Singleton Class
(Con)
4.3.2 main_activity.xml
4.3.3 MainActivity.java
Output
4.4 Using ImageLoader
 Create Singleton class
 main_activity.xml
 MainActivity.java
4.4.1 Create Singleton Class
4.4.1 Create Singleton Class (Con)
4.4.2 main_activity.xml
4.4.3 MainActivity.java
5. Using Request JSON
 Volley provides the following classes for JSON requests:
 JsonArrayRequest—A request for retrieving a JSONArray
response body at a given URL.
 JsonObjectRequest—A request for retrieving a JSONObject
response body at a given URL, allowing for an optional
JSONObject to be passed in as part of the request body.
Note: Both classes are based on the common base class
JsonRequest.
Example: Request JSON
 Create Singleton Class
 MainActivity.java Class
 main_activity.xml Class
Create Singleton Class
MainActivity.java
main_activity.xml
6. Implementing a Custom
Request
 Most requests have ready-to-use implementations in the
toolbox; if your response is a string, image, or JSON, you
probably won't need to implement a custom Request.
 For cases where you do need to implement a custom
request, this is all you need to do:
 Extend the Request<T> class, where <T> represents
the type of parsed response the request expects.
 Implement the abstract methods
parseNetworkResponse() and deliverResponse()
parseNetworkResponse
Method
 A Response encapsulates a parsed response for delivery, for
a given type (such as string, image, or JSON).
deliverResponse() Method
 Volley calls you back on the main thread with the object you
returned in parseNetworkResponse().
Example
Example (Con)
Reference
 https://developer.android.com/training/volley/index.html
 https://developer.android.com/training/volley/simple.html
 https://developer.android.com/training/volley/requestqueu
e.html
 https://developer.android.com/training/volley/request.html
 https://developer.android.com/training/volley/request-
custom.html

More Related Content

What's hot

Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen Hoeller
ZeroTurnaround
 
A Brief Introduce to WSGI
A Brief Introduce to WSGIA Brief Introduce to WSGI
A Brief Introduce to WSGI
Mingli Yuan
 
Java New Evolution
Java New EvolutionJava New Evolution
Java New Evolution
Allan Huang
 
Security_of_openstack_keystone
Security_of_openstack_keystoneSecurity_of_openstack_keystone
Security_of_openstack_keystone
UT, San Antonio
 

What's hot (12)

Apachecon 2009
Apachecon 2009Apachecon 2009
Apachecon 2009
 
Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen Hoeller
 
A Brief Introduce to WSGI
A Brief Introduce to WSGIA Brief Introduce to WSGI
A Brief Introduce to WSGI
 
Automated testing web services - part 1
Automated testing web services - part 1Automated testing web services - part 1
Automated testing web services - part 1
 
Java New Evolution
Java New EvolutionJava New Evolution
Java New Evolution
 
Keystone: Federated
Keystone: FederatedKeystone: Federated
Keystone: Federated
 
Servlet lifecycle
Servlet lifecycleServlet lifecycle
Servlet lifecycle
 
Spring 4 Web App
Spring 4 Web AppSpring 4 Web App
Spring 4 Web App
 
The Future of the Web
The Future of the WebThe Future of the Web
The Future of the Web
 
Entity framework 6
Entity framework 6Entity framework 6
Entity framework 6
 
Security_of_openstack_keystone
Security_of_openstack_keystoneSecurity_of_openstack_keystone
Security_of_openstack_keystone
 
Building IAM for OpenStack
Building IAM for OpenStackBuilding IAM for OpenStack
Building IAM for OpenStack
 

Similar to Transmitting network data using volley(14 09-16)

J2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentJ2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environment
joearunraja2
 
important struts interview questions
important struts interview questionsimportant struts interview questions
important struts interview questions
surendray
 
Apachecon 2002 Struts
Apachecon 2002 StrutsApachecon 2002 Struts
Apachecon 2002 Struts
yesprakash
 

Similar to Transmitting network data using volley(14 09-16) (20)

Mvc interview questions – deep dive jinal desai
Mvc interview questions – deep dive   jinal desaiMvc interview questions – deep dive   jinal desai
Mvc interview questions – deep dive jinal desai
 
Struts
StrutsStruts
Struts
 
J2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentJ2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environment
 
Skillwise Struts.x
Skillwise Struts.xSkillwise Struts.x
Skillwise Struts.x
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 9...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 9... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 9...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 9...
 
important struts interview questions
important struts interview questionsimportant struts interview questions
important struts interview questions
 
Liferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for DevelopersLiferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for Developers
 
IP UNIT III PPT.pptx
 IP UNIT III PPT.pptx IP UNIT III PPT.pptx
IP UNIT III PPT.pptx
 
Bt0083 server side programing
Bt0083 server side programing Bt0083 server side programing
Bt0083 server side programing
 
Apachecon 2002 Struts
Apachecon 2002 StrutsApachecon 2002 Struts
Apachecon 2002 Struts
 
Latest Selenium Interview Questions And Answers.pdf
Latest Selenium Interview Questions And Answers.pdfLatest Selenium Interview Questions And Answers.pdf
Latest Selenium Interview Questions And Answers.pdf
 
Struts2 course chapter 1: Evolution of Web Applications
Struts2 course chapter 1: Evolution of Web ApplicationsStruts2 course chapter 1: Evolution of Web Applications
Struts2 course chapter 1: Evolution of Web Applications
 
2-0. Spring ecosytem.pdf
2-0. Spring ecosytem.pdf2-0. Spring ecosytem.pdf
2-0. Spring ecosytem.pdf
 
Struts2.x
Struts2.xStruts2.x
Struts2.x
 
Adv java unit 4 M.Sc CS.pdf
Adv java unit 4 M.Sc CS.pdfAdv java unit 4 M.Sc CS.pdf
Adv java unit 4 M.Sc CS.pdf
 
Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners
 
J2EE-assignment
 J2EE-assignment J2EE-assignment
J2EE-assignment
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
ajava unit 1.pptx
ajava unit 1.pptxajava unit 1.pptx
ajava unit 1.pptx
 
Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applications
 

More from Sokngim Sa

More from Sokngim Sa (9)

06 UI Layout
06 UI Layout06 UI Layout
06 UI Layout
 
How to decompile apk
How to decompile apkHow to decompile apk
How to decompile apk
 
05 intent
05 intent05 intent
05 intent
 
04 activities and activity life cycle
04 activities and activity life cycle04 activities and activity life cycle
04 activities and activity life cycle
 
03 android application structure
03 android application structure03 android application structure
03 android application structure
 
02 getting start with android app development
02 getting start with android app development02 getting start with android app development
02 getting start with android app development
 
01 introduction to android
01 introduction to android01 introduction to android
01 introduction to android
 
Add eclipse project with git lab
Add eclipse project with git labAdd eclipse project with git lab
Add eclipse project with git lab
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 

Recently uploaded

Recently uploaded (20)

Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptx
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Keeping Your Information Safe with Centralized Security Services
Keeping Your Information Safe with Centralized Security ServicesKeeping Your Information Safe with Centralized Security Services
Keeping Your Information Safe with Centralized Security Services
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 

Transmitting network data using volley(14 09-16)

  • 1. Transmitting Network Data Using Volley 14/September/2016 – 20/September/2016 Prepared by: Ms. Sokngim Sa
  • 2. Content 1. Introduction Volley 2. Benefit of Volley 3. Sending a Simple Request 4. Setting Up a RequestQueue 5. Using ImageLoader 6. Using Request JSON 7. Implementing a Custom Request Using RequestString
  • 3. 1. Introduction Volley Volley is an HTTP library that makes networking for Android apps easier and most importantly, faster. Using Volley in your Project: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:24.0.0' compile 'com.android.volley:volley:1.0.0' }
  • 4. 2. Benefit of Volley  Automatic scheduling of network requests.  Multiple concurrent network connections.  Transparent disk and memory response caching with standard HTTP cache coherence.  Support for request prioritization.  Cancellation request API. You can cancel a single request, or you can set blocks or scopes of requests to cancel.  Ease of customization, for example, for retry and backoff.  Strong ordering that makes it easy to correctly populate your UI with data fetched asynchronously from the network.  Debugging and tracing tools.
  • 5. 3. Sending a Simple Request  Add the Internet permission  Use newRequestQueue  Send a RequestQueue  Cancel a Request
  • 6. 2.1 Add the Internet Permission  Add android.permission.INTERNET permission to app's manifest <uses-permission android:name="android.permission.INTERNET/>
  • 7. 2.2 Use newRequestQueue  Volley provides a convenience method Volley.newRequestQueue that sets up a RequestQueue for you, using default values, and starts the queue. // Instantiate the RequestQueue. RequestQueue queue = Volley.newRequestQueue(this);
  • 8. 2.3 Send a Request  To send a request, you simply construct one and add it to the RequestQueue object with add(StringRequest Object). // Add the request to the RequestQueue. queue.add(stringRequest);
  • 10. Example of RequestQueue and Send Request
  • 11. 2.4 Cancel a Request  To cancel a request, call cancelAll()on your Request object.  We can call cancel a request in onStop() method of An activtiy mRequestQueue.cancelAll(Object Tag); @Override protected void onStop () { super.onStop(); if (mRequestQueue != null) { mRequestQueue.cancelAll(TAG); } }
  • 12. Example  Define your tag and add it to your requests.
  • 13. Example (Con)  In your activity's onStop() method, cancel all requests that have this tag.
  • 14. 3. Setting up a RequestQueue  Set Up a Network and Cache  Use a Singleton Pattern
  • 15. 3.1 Set Up a Network and Cache  A RequestQueue needs two things to do its job: a network to perform transport of the requests, and a cache to handle caching.  There are standard implementations of these available in the Volley toolbox:  DiskBasedCache provides a one-file-per-response cache with an in-memory index  BasicNetwork provides a network transport based on your preferred HTTP client.  BasicNetwork is Volley's default network implementation. A BasicNetwork must be initialized with the HTTP client your app is using to connect to the network. Typically this is an HttpURLConnection.
  • 17. Note  If you just need to make a one-time request and don't want to leave the thread pool around, you can create the RequestQueue wherever you need it and call stop() on the RequestQueue once your response or error has come back.  using the Volley.newRequestQueue() method described in Sending a Simple Request.  But the more common use case is to create the RequestQueue as a singleton to keep it running for the lifetime of your app.
  • 18. 3.2 Use a Singleton Pattern  If your application makes constant use of the network, it's probably most efficient to set up a single instance of RequestQueue that will last the lifetime of your app. The recommended approach is to implement a singleton class that encapsulates RequestQueue and other Volley functionality.  Another approach is to subclass Application and set up the RequestQueue in Application.onCreate(). A key concept is that the RequestQueue must be instantiated with the Application context, not an Activity context. This ensures that the RequestQueue will last for the lifetime of your app, instead of being recreated every time the activity is recreated (for example, when the user rotates the device).
  • 21. 4. Making a Standard Request  Introduction to Standard Request  Request an Image  Use ImageRequest  Use ImageLoader and NetworkImageView  Request JSON
  • 22. 4.1 Introduction to Standard Request  StringRequest: Specify a URL and receive a raw string in response.  ImageRequest: Specify a URL and receive an image in response.  JsonObjectRequest and JsonArrayRequest (both subclasses of JsonRequest): Specify a URL and get a JSON object or array (respectively) in response.
  • 23. 4.2 Request an Image  Volley offers the following classes for requesting images. These classes layer on top of each other to offer different levels of support for processing images:  ImageRequest—a canned request for getting an image at a given URL and calling back with a decoded bitmap. It also provides convenience features like specifying a size to resize to.  ImageLoader—a helper class that handles loading and caching images from remote URLs. ImageLoader is a an orchestrator for large numbers of ImageRequests, for example when putting multiple thumbnails in a ListView.  NetworkImageView—builds on ImageLoader and effectively replaces ImageView for situations where your image is being fetched over the network via URL. NetworkImageView also manages canceling pending requests if the view is detached from the hierarchy.
  • 24. 4.3 Use ImageRequest  Create Singleton Class  MainActivity.java  Main_activity.xml
  • 26. 4.3.1 Create Singleton Class (Con)
  • 30. 4.4 Using ImageLoader  Create Singleton class  main_activity.xml  MainActivity.java
  • 32. 4.4.1 Create Singleton Class (Con)
  • 35. 5. Using Request JSON  Volley provides the following classes for JSON requests:  JsonArrayRequest—A request for retrieving a JSONArray response body at a given URL.  JsonObjectRequest—A request for retrieving a JSONObject response body at a given URL, allowing for an optional JSONObject to be passed in as part of the request body. Note: Both classes are based on the common base class JsonRequest.
  • 36. Example: Request JSON  Create Singleton Class  MainActivity.java Class  main_activity.xml Class
  • 40. 6. Implementing a Custom Request  Most requests have ready-to-use implementations in the toolbox; if your response is a string, image, or JSON, you probably won't need to implement a custom Request.  For cases where you do need to implement a custom request, this is all you need to do:  Extend the Request<T> class, where <T> represents the type of parsed response the request expects.  Implement the abstract methods parseNetworkResponse() and deliverResponse()
  • 41. parseNetworkResponse Method  A Response encapsulates a parsed response for delivery, for a given type (such as string, image, or JSON).
  • 42. deliverResponse() Method  Volley calls you back on the main thread with the object you returned in parseNetworkResponse().
  • 45. Reference  https://developer.android.com/training/volley/index.html  https://developer.android.com/training/volley/simple.html  https://developer.android.com/training/volley/requestqueu e.html  https://developer.android.com/training/volley/request.html  https://developer.android.com/training/volley/request- custom.html