An Introduction to Volley

At Google I/O, Google debuted the new, hip way to make network requests within an Android application by introducing the world to the Volley Networking Library.

Volley is a networking library that manages network requests and their response caches without the developer having to write a lot of code.It makes networking for Android apps easier and most importantly, faster.

It manages the processing and caching of network requests and it saves developers valuable time from writing the same network call/cache code again and again.

Volley is an android library released by Google that can be used to handle Android HTTP request and response.

Why use Volley?

Well we may ask why we need to use another library if we have already everything we need to handle network connection (i.e Http connection). Well, if you read the previous posts, we have noticed we have some work to do: for example we have to create an AsyncTask, handle the network connection erorrs and so on. Volley simplify everything and increases the app performances.

Features of Volley library

a) Automatically schedules the network requests.
b) Supports request prioritization. This means that you can load content depending of priorities, for example the main content could have a high priority, but the images a low priority.
c) Provides transparent disk and memory cache that allows for quick reloading of data. Transparent cache means that the caller doesn't have to know about the existence of the cache. That is, the cache is implemented automatically. You do, however, have the possibility to disable the caching.
d) Provides a good API for canceling requests. You can cancel a single request, or cancel requests depending on some filters.

Volley - StringRequest

Example 1

RequestQueue care of queuing the requests and handle the responses.Request is the base class for creating network requests (GET, POST).Listener is a callback interface for delivering the result, andErrorListener is a callback interface for delivering error responses.Step 1: VolleySingleton.javaStep 2: Add internet permissionStep 3: Create an instance of RequestQueueStep 4: Create the requestStep 6: Execute the requestStep 1: VolleySingleton.java

Introduction

In every Android application, you have to use the findViewById() method for each view in the layout that you want to use in your application's code. But as applications' designs get more complex layouts, the call to this method becomes repetitive and this is where the Butter Knife library comes in.

The Butter Knife library, developer and maintained by Jake Wharton (Square Inc.), has annotations that help developers to instantiate the views from our activity or fragment. It also has annotations to handle events like onClick(), onLongClick(), etc.

1. Using the Butter Knife Library

Step 1: Add the Dependency
Add the following dependency to the project's build.gradle file:

compile 'com.jakewharton:butterknife:7.0.1'

Next, synchronize your project with this file by pressing the synchronize button.Step 2: Use the Annotations
In every activity or fragment, you have to remove, or comment out, every call of the findViewById() method and add the @InjectView annotation before the declaration of the variable, indicating the identifier of the view.

You can now start using the views in your application's code. Butter Knife will handle the instantiation of every single view for you.
Here Reference

Using the Butter Knife Library with List Views

The ListView class is a special case to implement, because you instantiate the views inside an adapter. To integrate the Butter Knife library in a list view, you first have to create the custom layout for the items in the list view. I'm going to name mine list_view_item and add the following layout:

Finally, all you have to do is to instantiate the list view and attach the adapter. I'm going to do this inside a new activity, ListViewActivity, as shown below. You can see an example of this implementation in the source files of this tutorial.

Introduction

Introduction

In the passed Google Developer Summit Thailand, Google introduced us an Image Loader Library for Android developed by bumptech named Glide as a library that recommended by Google. It has been used in many Google open source projects till now including Google I/O 2014 official application.

Import to project

Both Picasso and Glide are on jcenter. You can simply import it to your project with dependency like this:Picasso

Ref : Diff. b/w Glide and PicassoNote to reader
We are not in any way associated with either Glide or Picasso - we're simply passionate Android developers sharing our results and experience with the two libraries.