Sunday, 14 June 2015

JSON Parsing Using Fragment with Implementation of AsyncTask ViewHolder and ListView

Toady i am posting a blog about json parsing using fragment and AsyncTask which display data using ViewHolder in Listview. I have googled more and more such type of article  but not get any one so, i decide to post it.
Below is the complete code of this article.

JSONParsingFragment.java


package com.rakesht.androidpracticeappdemo;

import java.io.IOException;
import java.util.ArrayList;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;


import android.app.ProgressDialog;
import android.net.ParseException;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

@SuppressWarnings("deprecation")
public class JSONParsingFragment extends Fragment{
ListView lv;
ArrayList<Actors> actorsList;

ActorAdapter adapter;