Android ListView using Volley



Library

implementation 'com.mcxiaoke.volley:library:1.0.19'


VolleyListViewActivity.java



 package hemanth.smartkit.com.Activity;  
 import android.app.ProgressDialog;  
 import android.content.Intent;  
 import android.os.AsyncTask;  
 import android.os.Bundle;  
 import android.support.v7.app.AppCompatActivity;  
 import android.util.Log;  
 import android.view.Surface;  
 import android.view.View;  
 import android.widget.AdapterView;  
 import android.widget.ListView;  
 import com.android.volley.DefaultRetryPolicy;  
 import com.android.volley.Request;  
 import com.android.volley.RequestQueue;  
 import com.android.volley.Response;  
 import com.android.volley.VolleyError;  
 import com.android.volley.VolleyLog;  
 import com.android.volley.toolbox.JsonObjectRequest;  
 import com.android.volley.toolbox.Volley;  
 import org.json.JSONArray;  
 import org.json.JSONException;  
 import org.json.JSONObject;  
 import java.util.ArrayList;  
 import java.util.List;  
 import java.util.Timer;  
 import java.util.TimerTask;  
 import hemanth.smartkit.com.Adapter.VolleyListViewAdapter;  
 import hemanth.smartkit.com.Bean.CommonBean;  
 import hemanth.smartkit.com.R;  
 public class VolleyListViewActivity extends AppCompatActivity {  
   ListView ListView;  
   private VolleyListViewAdapter adapter;  
   private List<CommonBean> VolleyList = new ArrayList<CommonBean>();  
   private ProgressDialog mprocessingdialog;  
   @Override  
   protected void onCreate(Bundle savedInstanceState) {  
     super.onCreate(savedInstanceState);  
     setContentView(R.layout.activity_volley_list_view);  
     InItUi();  
     ActionUi();  
     new VolleyListViewActivity.GetListAsync().execute();  
   }  
   private void InItUi() {  
     ListView = (ListView) findViewById(R.id.ListView);  
     adapter = new VolleyListViewAdapter(VolleyListViewActivity.this, VolleyList);  
     ListView.setAdapter(adapter);  
   }  
   private void ActionUi() {  
   }  
   private class GetListAsync extends AsyncTask<Void, Void, Void> {  
     final String UserId_server = "137";  
     @Override  
     protected void onPreExecute() {  
       // TODO Auto-generated method stub  
       super.onPreExecute();  
       mprocessingdialog = new ProgressDialog(VolleyListViewActivity.this);  
       mprocessingdialog.setTitle("Please Wait..");  
       mprocessingdialog.setMessage("Loading");  
       mprocessingdialog.setIndeterminate(false);  
       mprocessingdialog.setCancelable(false);  
       mprocessingdialog.show();  
     }  
     @Override  
     protected Void doInBackground(Void... arg0) {  
       // TODO Auto-generated method stub  
       Log.e("rlog", UserId_server);  
       JSONObject params = new JSONObject();  
       try {  
         params.put("user_id", UserId_server);  
       } catch (JSONException e) {  
         e.printStackTrace();  
       }  
       JsonObjectRequest jsonObjReq = new JsonObjectRequest(  
           Request.Method.POST, "http://54.244.96.209:8080/Crosspaydevelopment/transactionHistory", params,  
           new Response.Listener<JSONObject>() {  
             @Override  
             public void onResponse(JSONObject response) {  
               Log.d("rlog", response.toString());  
               String Res = "{\n" +  
                   " \"data\": [\n" +  
                   "  {\n" +  
                   "   \"branchcode\": \"--------\",\n" +  
                   "   \"country\": \"INDIA\",\n" +  
                   "   \"account_ccycode\": \"INR\",\n" +  
                   "   \"city\": \"UNITED\",\n" +  
                   "   \"accout_type\": \"Account Credit\",\n" +  
                   "   \"txn_date\": \"31-10-2018 10:53\",\n" +  
                   "   \"total_amount\": \"50.0\",\n" +  
                   "   \"rate\": 8.19,\n" +  
                   "   \"sofcode\": \"Salary\",\n" +  
                   "   \"txn_no\": \"200000004179\",\n" +  
                   "   \"payin_ccycode\": \"NOK\",\n" +  
                   "   \"branch_name\": \"kkr\",\n" +  
                   "   \"name\": \"ANUSHA ui D\",\n" +  
                   "   \"payee_amount\": \"163.8\",\n" +  
                   "   \"porcode\": \"Medical Expense\",\n" +  
                   "   \"payin_amount\": \"20.0\",\n" +  
                   "   \"commission\": \"30.0\",\n" +  
                   "   \"ifsc\": \"IFSC0566233\",\n" +  
                   "   \"accout_num\": \"312522220233\",\n" +  
                   "   \"order_id\": \"order486091058\",\n" +  
                   "   \"txn_status\": 3,\n" +  
                   "   \"bankcode\": \"--------\",\n" +  
                   "   \"status\": \"3\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"branchcode\": \"--------\",\n" +  
                   "   \"country\": \"INDIA\",\n" +  
                   "   \"account_ccycode\": \"INR\",\n" +  
                   "   \"city\": \"UNITED\",\n" +  
                   "   \"accout_type\": \"Account Credit\",\n" +  
                   "   \"txn_date\": \"31-10-2018 10:51\",\n" +  
                   "   \"total_amount\": \"20.0\",\n" +  
                   "   \"rate\": 83.58,\n" +  
                   "   \"sofcode\": \"Loan/Credit Card\",\n" +  
                   "   \"txn_no\": \"200000004178\",\n" +  
                   "   \"payin_ccycode\": \"GBP\",\n" +  
                   "   \"branch_name\": \"kkr\",\n" +  
                   "   \"name\": \"ANUSHA ui D\",\n" +  
                   "   \"payee_amount\": \"1671.6\",\n" +  
                   "   \"porcode\": \"Investment in Real Estate\",\n" +  
                   "   \"payin_amount\": \"20.0\",\n" +  
                   "   \"commission\": \"0.0\",\n" +  
                   "   \"ifsc\": \"IFSC0566233\",\n" +  
                   "   \"accout_num\": \"312522220233\",\n" +  
                   "   \"order_id\": \"order929568370\",\n" +  
                   "   \"txn_status\": 3,\n" +  
                   "   \"bankcode\": \"--------\",\n" +  
                   "   \"status\": \"3\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"branchcode\": \"--------\",\n" +  
                   "   \"country\": \"DENMARK\",\n" +  
                   "   \"account_ccycode\": \"DKK\",\n" +  
                   "   \"city\": \"killl\",\n" +  
                   "   \"accout_type\": \"Account Credit\",\n" +  
                   "   \"txn_date\": \"31-10-2018 10:32\",\n" +  
                   "   \"total_amount\": \"27.0\",\n" +  
                   "   \"rate\": 7.45,\n" +  
                   "   \"sofcode\": \"Gift/Donation\",\n" +  
                   "   \"txn_no\": \"200000004177\",\n" +  
                   "   \"payin_ccycode\": \"EUR\",\n" +  
                   "   \"branch_name\": \"--------\",\n" +  
                   "   \"name\": \"mallika keerti\",\n" +  
                   "   \"payee_amount\": \"186.25\",\n" +  
                   "   \"porcode\": \"Family or Friend Support\",\n" +  
                   "   \"payin_amount\": \"25.0\",\n" +  
                   "   \"commission\": \"2.0\",\n" +  
                   "   \"ifsc\": \"LKOIDNER\",\n" +  
                   "   \"accout_num\": \"DN234567876543456\",\n" +  
                   "   \"order_id\": \"order841391967\",\n" +  
                   "   \"txn_status\": 3,\n" +  
                   "   \"bankcode\": \"--------\",\n" +  
                   "   \"status\": \"3\"\n" +  
                   "  },\n" +  
                   " \n" +  
                   "  {\n" +  
                   "   \"branchcode\": \"--------\",\n" +  
                   "   \"country\": \"PHILIPPINES\",\n" +  
                   "   \"account_ccycode\": \"PHP\",\n" +  
                   "   \"city\": \"Hy\",\n" +  
                   "   \"accout_type\": \"Account Credit\",\n" +  
                   "   \"txn_date\": \"25-07-2018 11:45\",\n" +  
                   "   \"total_amount\": \"189.0\",\n" +  
                   "   \"rate\": 70.3,\n" +  
                   "   \"sofcode\": \"Sale of Property/Car\",\n" +  
                   "   \"txn_no\": \"200000002351\",\n" +  
                   "   \"payin_ccycode\": \"GBP\",\n" +  
                   "   \"branch_name\": \"branch\",\n" +  
                   "   \"name\": \"Hg Gt\",\n" +  
                   "   \"payee_amount\": \"13005.5\",\n" +  
                   "   \"porcode\": \"Purchase of Services\",\n" +  
                   "   \"payin_amount\": \"185.0\",\n" +  
                   "   \"commission\": \"4.0\",\n" +  
                   "   \"ifsc\": \"----------\",\n" +  
                   "   \"accout_num\": \"5666655\",\n" +  
                   "   \"order_id\": \"order749334228\",\n" +  
                   "   \"txn_status\": 7,\n" +  
                   "   \"bankcode\": \"--------\",\n" +  
                   "   \"status\": \"7\"\n" +  
                   "  }\n" +  
                   " ],\n" +  
                   " \"message\": \"success\",\n" +  
                   " \"status\": \"200\"\n" +  
                   "}";  
               try {  
                 JSONObject jsonObj = new JSONObject(Res);  
                 JSONArray jsonArray = jsonObj.getJSONArray("data");  
                 for (int i = 0; i < jsonArray.length(); i++) {  
                   JSONObject obj = jsonArray.getJSONObject(i);  
                   CommonBean commonBean = new CommonBean();  
                   commonBean.setCountry(obj.optString("country"));  
                   commonBean.setCity(obj.optString("city"));  
                   commonBean.setTxn_date(obj.optString("txn_date"));  
                   commonBean.setTotal_amount(obj.optString("total_amount"));  
                   commonBean.setAccount_ccycode(obj.optString("account_ccycode"));  
                   commonBean.setRate(obj.optString("rate"));  
                   commonBean.setTxn_no(obj.optString("txn_no"));  
                   commonBean.setPayin_ccycode(obj.optString("payin_ccycode"));  
                   commonBean.setPayin_amount(obj.optString("payin_amount"));  
                   commonBean.setName(obj.optString("name"));  
                   commonBean.setPayee_amount(obj.optString("payee_amount"));  
                   commonBean.setIfsc(obj.optString("ifsc"));  
                   commonBean.setAccout_num(obj.optString("accout_num"));  
                   commonBean.setOrder_id(obj.optString("order_id"));  
                   commonBean.setCommission(obj.optString("commission"));  
                   commonBean.setTxn_status(obj.optString("txn_status"));  
                   commonBean.setBranchcode(obj.optString("branchcode"));  
                   commonBean.setAccout_type(obj.optString("accout_type"));  
                   commonBean.setSofcode(obj.optString("sofcode"));  
                   commonBean.setPorcode(obj.optString("porcode"));  
                   commonBean.setBranchname(obj.optString("branch_name")); //branch_name  
                   VolleyList.add(commonBean);  
                 }  
                 mprocessingdialog.dismiss();  
               } catch (JSONException e) {  
                 e.printStackTrace();  
               } catch (Surface.OutOfResourcesException e) {  
                 e.printStackTrace();  
               }  
               adapter.notifyDataSetChanged();  
 //              Collections.sort(historylist, new Comparator<HistoryBean>() {  
 //                public int compare(HistoryBean o1, HistoryBean o2) {  
 //                  if (o1.getTxn_date() == null || o2.getTxn_date() == null) {  
 //                    return 0;  
 //                  }  
 //  
 //                  return o1.getTxn_date().compareTo(o2.getTxn_date());  
 //                }  
 //              });  
 //              Collections.reverse(historylist);  
               ListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {  
                 @Override  
                 public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {  
                   CommonBean historyBean = VolleyList.get(i);  
 //                  Toast.makeText(HistoryActivity.this.getApplicationContext(), historyBean.getName() + "\n" + historyBean.getThumbnailUrl(), Toast.LENGTH_SHORT).show();  
                   Intent intent = new Intent(VolleyListViewActivity.this, VolleyDetailViewActivity.class);  
                   intent.putExtra("country", historyBean.getCountry());  
                   intent.putExtra("city", historyBean.getCity());  
                   intent.putExtra("txn_date", historyBean.getTxn_date());  
                   intent.putExtra("total_amount", historyBean.getTotal_amount());  
                   intent.putExtra("account_ccycode", historyBean.getAccount_ccycode());  
                   intent.putExtra("rate", historyBean.getRate());  
                   intent.putExtra("txn_no", historyBean.getTxn_no());  
                   intent.putExtra("payin_ccycode", historyBean.getPayin_ccycode());  
                   intent.putExtra("payin_amount", historyBean.getPayin_amount());  
                   intent.putExtra("name", historyBean.getName());  
                   intent.putExtra("payee_amount", historyBean.getPayee_amount());  
                   intent.putExtra("ifsc", historyBean.getIfsc());  
                   intent.putExtra("accout_num", historyBean.getAccout_num());  
                   intent.putExtra("order_id", historyBean.getOrder_id());  
                   intent.putExtra("txn_status", historyBean.getTxn_status());  
                   intent.putExtra("commission", historyBean.getCommission());  
                   intent.putExtra("txn_status", historyBean.getTxn_status());  
                   intent.putExtra("accout_type", historyBean.getAccout_type());  
                   intent.putExtra("sofcode", historyBean.getSofcode());  
                   intent.putExtra("porcode", historyBean.getPorcode());  
                   intent.putExtra("branchcode", historyBean.getBranchcode());  
                   intent.putExtra("branchname", historyBean.getBranchname());  
                   VolleyListViewActivity.this.startActivity(intent);  
                 }  
               });  
             }  
           }, new Response.ErrorListener() {  
         @Override  
         public void onErrorResponse(VolleyError error) {  
           VolleyLog.d("rlog", "Error: " + error.getMessage());  
         }  
       });  
       jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(0, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));  
       RequestQueue requestQueue = Volley.newRequestQueue(VolleyListViewActivity.this);  
       requestQueue.add(jsonObjReq);  
       return null;  
     }  
     @Override  
     protected void onPostExecute(Void result) {  
       super.onPostExecute(result);  
       new Timer().schedule(new TimerTask() {  
         @Override  
         public void run() {  
           mprocessingdialog.dismiss();  
         }  
       }, 10000);  
     }  
   }  
 }  


activity_volley_list_view.xml

 <?xml version="1.0" encoding="utf-8"?>  
 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"  
   xmlns:tools="http://schemas.android.com/tools"  
   android:layout_width="match_parent"  
   android:layout_height="match_parent"  
   tools:context=".Activity.VolleyListViewActivity">  
   <ListView  
     android:id="@+id/ListView"  
     android:layout_width="match_parent"  
     android:layout_height="match_parent"  
     android:layout_margin="5dp"  
     android:scrollbars="none" />  
 </android.support.constraint.ConstraintLayout> 

VolleyListViewAdapter.java

 package hemanth.smartkit.com.Adapter;  
 import android.app.Activity;  
 import android.content.Context;  
 import android.view.LayoutInflater;  
 import android.view.View;  
 import android.view.ViewGroup;  
 import android.widget.BaseAdapter;  
 import android.widget.Button;  
 import android.widget.Filter;  
 import android.widget.Filterable;  
 import android.widget.TextView;  
 import java.text.ParseException;  
 import java.text.SimpleDateFormat;  
 import java.util.ArrayList;  
 import java.util.Date;  
 import java.util.List;  
 import java.util.Locale;  
 import hemanth.smartkit.com.Bean.CommonBean;  
 import hemanth.smartkit.com.R;  
 public class VolleyListViewAdapter extends BaseAdapter implements Filterable {  
   private Activity activity;  
   private LayoutInflater inflater;  
   List<CommonBean> VolleyList;  
   List<CommonBean> searchlist;  
 //   ImageView thumbNail;  
 //   ArrayList<HistoryBean> arraylist;  
   public VolleyListViewAdapter(Activity activity, List<CommonBean> VolleyList) {  
     this.activity = activity;  
     this.VolleyList = VolleyList;  
 //    this.arraylist = new ArrayList<HistoryBean>();  
 //    this.arraylist.addAll(HistoryBeanList);  
   }  
   public class ViewHolder {  
     TextView Name;  
     TextView AccountType;  
     TextView Date;  
     Button success;  
     Button Processing;  
     Button Fail;  
   }  
   @Override  
   public int getCount() {  
     return VolleyList.size();  
   }  
   @Override  
   public Object getItem(int location) {  
     return VolleyList.get(location);  
   }  
   @Override  
   public long getItemId(int position) {  
     return position;  
   }  
   @Override  
   public View getView(final int position, View convertView, ViewGroup parent) {  
     final ViewHolder holder;  
     holder = new ViewHolder();  
     if (inflater == null)  
       inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);  
     if (convertView == null)  
       convertView = inflater.inflate(R.layout.volley_listview_item, null);  
 //    thumbNail = (ImageView) convertView.findViewById(R.id.flag);  
     holder.Name = (TextView) convertView.findViewById(R.id.Name);  
     holder.AccountType = (TextView) convertView.findViewById(R.id.AccountType);  
     holder.Date = (TextView) convertView.findViewById(R.id.Date);  
     holder.success = (Button) convertView.findViewById(R.id.success);  
     holder.Processing = (Button) convertView.findViewById(R.id.Processing);  
     holder.Fail = (Button) convertView.findViewById(R.id.Fail);  
 //    final ImageView imageView = (ImageView) convertView.findViewById(R.id.unchecked);  
     CommonBean commonBean = VolleyList.get(position);  
 //    Glide.with(activity).load(m.getThumbnailUrl()).transform(new CircleTransform(activity)).into(thumbNail);  
 //    holder.name.setText("GBP 1000.00");  
     holder.Name.setText(commonBean.getName());  
 //    holder.AccountNumber.setText(historybean.getAccout_num());  
 //    holder.Date.setText(historybean.getTxn_date());  
     holder.AccountType.setText(commonBean.getAccout_type());  
 //    if (historybean.getAccout_num().equalsIgnoreCase("Bank Transfer")) {  
 //      holder.AccountNumber.setText(historybean.getAccout_num());  
 //    }else if (historybean.getAccout_num().equalsIgnoreCase("Cash Transaction")) {  
 //      holder.AccountNumber.setText(historybean.getAccout_num());  
 //    } else {  
 //      holder.AccountNumber.setText("A/C : " +historybean.getAccout_num());  
 //    }  
     String datesplit[] = commonBean.getTxn_date().split(" ") ;  
     String date = datesplit[0] ;  
     SimpleDateFormat input = new SimpleDateFormat("dd-MM-yy");  
     SimpleDateFormat output = new SimpleDateFormat("dd-MM-yyyy");  
     try {  
       Date oneWayTripDate = input.parse(date);  
       holder.Date.setText(output.format(oneWayTripDate)+" "+datesplit[1]);  
     } catch (ParseException e) {  
       e.printStackTrace();  
     }  
 //    if(historybean.getTxn_status().equals("1")){  
 //      holder.success.setVisibility(View.VISIBLE);  
 //      holder.Processing.setVisibility(View.GONE);  
 //      holder.Fail.setVisibility(View.GONE);  
 //    }  
 //    if(historybean.getTxn_status().equals("3") || historybean.getTxn_status().equals("7") || historybean.getTxn_status().equals("-2") || historybean.getTxn_status().equals("-3")){  
 //      holder.success.setVisibility(View.GONE);  
 //      holder.Processing.setVisibility(View.VISIBLE);  
 //      holder.Fail.setVisibility(View.GONE);  
 //    }  
 //    if(historybean.getTxn_status().equals("-1")){  
 //      holder.success.setVisibility(View.GONE);  
 //      holder.Processing.setVisibility(View.GONE);  
 //      holder.Fail.setVisibility(View.VISIBLE);  
 //    }  
 //  
 //    year.setText(String.valueOf(m.getYear()));  
 //    name.setText(m.getName());  
 //    holder.Date.setText(historylist.get(position).getTxn_date());  
 //    source.setText("Account NO: " + String.valueOf(m.getSource()));  
 //    worth.setText(String.valueOf(m.getWorth()));  
 //    year.setText(String.valueOf(m.getYear()));  
     return convertView;  
   }  
   // Filter Class  
 //  public void filter(String charText) {  
 //    charText = charText.toLowerCase(Locale.getDefault());  
 //    HistoryBeanList.clear();  
 //    if (charText.length() == 0) {  
 //      HistoryBeanList.addAll(arraylist);  
 //      Toast.makeText(activity,"1" , Toast.LENGTH_SHORT).show();  
 //  
 //    }  
 //    else  
 //    {  
 //      Toast.makeText(activity,"2" , Toast.LENGTH_SHORT).show();  
 //      for (HistoryBean wp : arraylist)  
 //      {  
 //        if (wp.getName().toLowerCase(Locale.getDefault()).contains(charText))  
 //        {  
 //          Toast.makeText(activity,"3" , Toast.LENGTH_SHORT).show();  
 //  
 //          HistoryBeanList.add(wp);  
 //        }  
 //      }  
 //    }  
 //    notifyDataSetChanged();  
 //  }  
   @Override  
   public Filter getFilter() {  
     Filter filter = new Filter() {  
       @SuppressWarnings("unchecked")  
       @Override  
       protected void publishResults(CharSequence constraint, FilterResults results) {  
         VolleyList = (ArrayList<CommonBean>) results.values; // has  
         notifyDataSetChanged();  
       }  
       @Override  
       protected FilterResults performFiltering(CharSequence constraint) {  
         FilterResults results = new FilterResults(); // Holds the  
         // results of a  
         // filtering  
         // operation in  
         // values  
         // List<String> FilteredArrList = new ArrayList<String>();  
         List<CommonBean> FilteredArrList = new ArrayList<CommonBean>();  
         if (searchlist == null) {  
           searchlist = new ArrayList<CommonBean>(VolleyList); // saves  
         }  
         /********  
          *  
          * If constraint(CharSequence that is received) is null returns  
          * the mOriginalValues(Original) values else does the Filtering  
          * and returns FilteredArrList(Filtered)  
          *  
          ********/  
         if (constraint == null || constraint.length() == 0) {  
           // set the Original result to return  
           results.count = searchlist.size();  
           results.values = searchlist;  
         } else {  
           Locale locale = Locale.getDefault();  
           constraint = constraint.toString().toLowerCase(locale);  
           for (int i = 0; i < searchlist.size(); i++) {  
             CommonBean model = searchlist.get(i);  
             String SearchName = model.getName();  
             String SearchDate = model.getTxn_date();  
 //            String SearchIFSC = model.getIfsc();  
             if (SearchName.toLowerCase(locale).contains(constraint.toString()) || SearchDate.toLowerCase(locale).contains(constraint.toString())) {  
               FilteredArrList.add(model);  
 //              Toast.makeText(activity,"1" , Toast.LENGTH_SHORT).show();  
             }  
           }  
           // set the Filtered result to return  
           results.count = FilteredArrList.size();  
           results.values = FilteredArrList;  
         }  
         return results;  
       }  
     };  
     return filter;  
   }  
 //  public static class CircleTransform extends BitmapTransformation {  
 //    public CircleTransform(Context context) {  
 //      super(context);  
 //    }  
 //  
 //    @Override  
 //    protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {  
 //      return circleCrop(pool, toTransform);  
 //    }  
 //  
 //    private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {  
 //      if (source == null) return null;  
 //  
 //      int size = Math.min(source.getWidth(), source.getHeight());  
 //      int x = (source.getWidth() - size) / 2;  
 //      int y = (source.getHeight() - size) / 2;  
 //  
 //      // TODO this could be acquired from the pool too  
 //      Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);  
 //  
 //      Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);  
 //      if (result == null) {  
 //        result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);  
 //      }  
 //  
 //      Canvas canvas = new Canvas(result);  
 //      Paint paint = new Paint();  
 //      paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));  
 //      paint.setAntiAlias(true);  
 //      float r = size / 2f;  
 //      canvas.drawCircle(r, r, r, paint);  
 //      return result;  
 //    }  
 //  
 //    @Override  
 //    public String getId() {  
 //      return getClass().getName();  
 //    }  
 //  }  
 }  


CommonBean.java

package hemanth.smartkit.com.Bean;  
 public class CommonBean {  
   private String country;  
   private String city;  
   private String txn_date;  
   private String total_amount;  
   private String account_ccycode;  
   private String Rate;  
   private String txn_no;  
   private String payin_ccycode;  
   private String name;  
   private String payee_amount;  
   private String ifsc;  
   private String accout_num;  
   private String order_id;  
   private String txn_status;  
   private String commission;  
   private String payin_amount;  
   private String accout_type;  
   private String porcode;  
   private String sofcode;  
   private String branchcode;  
   public String getBranchname() {  
     return branchname;  
   }  
   public void setBranchname(String branchname) {  
     this.branchname = branchname;  
   }  
   private String branchname;  
   public String getBranchcode() {  
     return branchcode;  
   }  
   public void setBranchcode(String branchcode) {  
     this.branchcode = branchcode;  
   }  
   public String getAccout_type() {  
     return accout_type;  
   }  
   public void setAccout_type(String accout_type) {  
     this.accout_type = accout_type;  
   }  
   public String getPorcode() {  
     return porcode;  
   }  
   public void setPorcode(String porcode) {  
     this.porcode = porcode;  
   }  
   public String getSofcode() {  
     return sofcode;  
   }  
   public void setSofcode(String sofcode) {  
     this.sofcode = sofcode;  
   }  
   public String getCountry() {  
     return country;  
   }  
   public void setCountry(String country) {  
     this.country = country;  
   }  
   public String getCity() {  
     return city;  
   }  
   public void setCity(String city) {  
     this.city = city;  
   }  
   public String getCommission() {  
     return commission;  
   }  
   public void setCommission(String commission) {  
     this.commission = commission;  
   }  
   public String getPayin_amount() {  
     return payin_amount;  
   }  
   public void setPayin_amount(String payin_amount) {  
     this.payin_amount = payin_amount;  
   }  
   public String getTxn_date() {  
     return txn_date;  
   }  
   public void setTxn_date(String txn_date) {  
     this.txn_date = txn_date;  
   }  
   public String getTotal_amount() {  
     return total_amount;  
   }  
   public void setTotal_amount(String total_amount) {  
     this.total_amount = total_amount;  
   }  
   public String getAccount_ccycode() {  
     return account_ccycode;  
   }  
   public void setAccount_ccycode(String account_ccycode) {  
     this.account_ccycode = account_ccycode;  
   }  
   public String getRate() {  
     return Rate;  
   }  
   public void setRate(String rate) {  
     Rate = rate;  
   }  
   public String getTxn_no() {  
     return txn_no;  
   }  
   public void setTxn_no(String txn_no) {  
     this.txn_no = txn_no;  
   }  
   public String getPayin_ccycode() {  
     return payin_ccycode;  
   }  
   public void setPayin_ccycode(String payin_ccycode) {  
     this.payin_ccycode = payin_ccycode;  
   }  
   public String getName() {  
     return name;  
   }  
   public void setName(String name) {  
     this.name = name;  
   }  
   public String getPayee_amount() {  
     return payee_amount;  
   }  
   public void setPayee_amount(String payee_amount) {  
     this.payee_amount = payee_amount;  
   }  
   public String getIfsc() {  
     return ifsc;  
   }  
   public void setIfsc(String ifsc) {  
     this.ifsc = ifsc;  
   }  
   public String getAccout_num() {  
     return accout_num;  
   }  
   public void setAccout_num(String accout_num) {  
     this.accout_num = accout_num;  
   }  
   public String getOrder_id() {  
     return order_id;  
   }  
   public void setOrder_id(String order_id) {  
     this.order_id = order_id;  
   }  
   public String getTxn_status() {  
     return txn_status;  
   }  
   public void setTxn_status(String txn_status) {  
     this.txn_status = txn_status;  
   }  
 }  

volley_listview_item.xml



 <?xml version="1.0" encoding="utf-8"?>  
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
   xmlns:app="http://schemas.android.com/apk/res-auto"  
   android:layout_width="match_parent"  
   android:layout_height="match_parent"  
   android:baselineAligned="false"  
   android:descendantFocusability="blocksDescendants"  
   android:orientation="vertical">  
   <LinearLayout  
     android:layout_width="match_parent"  
     android:layout_height="wrap_content"  
     android:orientation="horizontal">  
     <TableRow  
       android:layout_width="fill_parent"  
       android:layout_height="wrap_content">  
       <ImageView  
         android:id="@+id/flag"  
         android:layout_width="80dp"  
         android:layout_height="60dp"  
         android:layout_gravity="center"  
         android:layout_margin="5dp"  
         app:srcCompat="@mipmap/ic_launcher" />  
       <!--<de.hdodenhof.circleimageview.CircleImageView-->  
       <!--android:id="@+id/flag"-->  
       <!--android:layout_width="80dp"-->  
       <!--android:layout_height="60dp"-->  
       <!--android:layout_gravity="center"-->  
       <!--android:layout_margin="5dp"-->  
       <!--android:src="@drawable/user"-->  
       <!--app:civ_border_color="@color/skyblue" />-->  
       <TableRow  
         android:layout_width="match_parent"  
         android:layout_height="wrap_content"  
         android:layout_gravity="center"  
         android:layout_margin="5dp"  
         android:orientation="vertical">  
         <LinearLayout  
           android:id="@+id/L1"  
           android:layout_width="match_parent"  
           android:layout_height="wrap_content"  
           android:layout_gravity="center"  
           android:orientation="horizontal">  
           <LinearLayout  
             android:layout_width="wrap_content"  
             android:layout_height="wrap_content"  
             android:layout_gravity="center"  
             android:layout_weight="1"  
             android:orientation="vertical">  
             <TextView  
               android:id="@+id/Name"  
               android:layout_width="wrap_content"  
               android:layout_height="wrap_content"  
               android:textSize="14dp"  
               android:textStyle="bold" />  
             <TextView  
               android:id="@+id/AccountType"  
               android:layout_width="wrap_content"  
               android:layout_height="wrap_content"  
               android:textSize="14dp" />  
             <TextView  
               android:id="@+id/Date"  
               android:layout_width="wrap_content"  
               android:layout_height="wrap_content"  
               android:textSize="12dp" />  
           </LinearLayout>  
           <LinearLayout  
             android:id="@+id/L2"  
             android:layout_width="wrap_content"  
             android:layout_height="wrap_content"  
             android:layout_gravity="right|center"  
             android:orientation="horizontal">  
             <Button  
               android:id="@+id/success"  
               android:layout_width="70dp"  
               android:layout_height="20dp"  
               android:layout_gravity="center"  
               android:padding="0dp"  
               android:text="Success"  
               android:textAllCaps="false"  
               android:textSize="10sp"  
               android:visibility="gone" />  
             <Button  
               android:id="@+id/Processing"  
               android:layout_width="70dp"  
               android:layout_height="20dp"  
               android:layout_gravity="center"  
               android:padding="0dp"  
               android:text="In Process"  
               android:textAllCaps="false"  
               android:textSize="10sp"  
               android:visibility="gone" />  
             <Button  
               android:id="@+id/Fail"  
               android:layout_width="70dp"  
               android:layout_height="20dp"  
               android:layout_gravity="center"  
               android:padding="0dp"  
               android:text="Fail"  
               android:textAllCaps="false"  
               android:textSize="10sp"  
               android:visibility="gone" />  
           </LinearLayout>  
         </LinearLayout>  
       </TableRow>  
     </TableRow>  
   </LinearLayout>  
   <View  
     android:layout_width="match_parent"  
     android:layout_height="2dp" />  
 </LinearLayout>