Skip to content

Instantly share code, notes, and snippets.

View apvasanth03's full-sized avatar

VasanthaKumar Annadurai apvasanth03

View GitHub Profile
@apvasanth03
apvasanth03 / PDFUtil
Created February 4, 2017 04:53
Android PDF Generator example
package com.vm.trinity.common.ui;
import android.annotation.TargetApi;
import android.graphics.Canvas;
import android.graphics.pdf.PdfDocument;
import android.os.AsyncTask;
import android.os.Build;
import android.util.Log;
import android.view.View;
@apvasanth03
apvasanth03 / MainActivity.java
Created November 13, 2016 18:41
Android Http Client Abstraction - MainActivity
package com.vasanth.restapiapplication;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.vasanth.restapiapplication.httprestapi.HttpClientApi;
@apvasanth03
apvasanth03 / RestApiApplication.java
Created November 13, 2016 18:41
Android Http Client Abstraction - RestApiApplication
package com.vasanth.restapiapplication;
import android.app.Application;
import com.vasanth.restapiapplication.httprestapi.HttpClientApi;
import com.vasanth.restapiapplication.httprestapi.volley.VolleyHttpRestApiImpl;
/**
* Rest Api Application.
* <p>
@apvasanth03
apvasanth03 / VolleyStringRequest.java
Created November 13, 2016 18:28
Android Http Client Abstraction - VolleyStringRequest
package com.vasanth.restapiapplication.httprestapi.volley;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.NetworkError;
import com.android.volley.Response;
import com.android.volley.TimeoutError;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.vasanth.restapiapplication.httprestapi.HttpClientApi;
@apvasanth03
apvasanth03 / VolleySingleton.java
Created November 13, 2016 18:27
Android Http Client Abstraction - VolleySingleton
package com.vasanth.restapiapplication.httprestapi.volley;
import android.content.Context;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
/**
* Volley Singleton.
@apvasanth03
apvasanth03 / VolleyHttpRestApiImpl.java
Last active November 13, 2016 18:35
Android Http Client Abstraction - VolleyHttpRestApiImpl
package com.vasanth.restapiapplication.httprestapi.volley;
import android.content.Context;
import com.android.volley.Request;
import com.vasanth.restapiapplication.httprestapi.HttpClientApi;
import java.util.Map;
/**
@apvasanth03
apvasanth03 / HttpClientApi.java
Last active November 13, 2016 18:44
Android Http Client Abstraction - HttpClientApi
package com.vasanth.restapiapplication.httprestapi;
import java.util.Map;
/**
* Http Client Api.
* <p>
* 1. Responsibility.
* 1.a. Interface defines Common HTTP Methods.
* 1.b. Hence we need to implement this interface using some HTTP client (like Volley, Retrofit etc) and