Android Spinner using Volley


Library

implementation 'com.github.bumptech.glide:glide:3.7.0'


json

{
  "country": [
    {
      "country_code": "GBP",
      "countryisocode": "GBR",
      "isd_code": "+44",
      "countryisocode2": "UK",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "UNITED KINGDOM",
      "country_status": "2"
    },
    {
      "country_code": "INR",
      "countryisocode": "IND",
      "isd_code": "+91",
      "countryisocode2": "IN",
      "country_image": "https://ws.crosspaymt.com/img/inr.png",
      "country_name": "INDIA",
      "country_status": "1"
    },
    {
      "country_code": "PHP",
      "countryisocode": "PHL",
      "isd_code": "+63",
      "countryisocode2": "PH",
      "country_image": "https://ws.crosspaymt.com/img/php.png",
      "country_name": "PHILIPPINES",
      "country_status": "1"
    },
    {
      "country_code": "USD",
      "countryisocode": "USA",
      "isd_code": "+1",
      "countryisocode2": "US",
      "country_image": "https://ws.crosspaymt.com/img/us.png",
      "country_name": "UNITED STATES",
      "country_status": "1"
    },
    {
      "country_code": "NOK",
      "countryisocode": "NOR",
      "isd_code": "+47",
      "countryisocode2": "NO",
      "country_image": "https://ws.crosspaymt.com/img/nok.jpg",
      "country_name": "NORWAY",
      "country_status": "2"
    },
    {
      "country_code": "EUR",
      "countryisocode": "DEU",
      "isd_code": "+49",
      "countryisocode2": "DE",
      "country_image": "https://ws.crosspaymt.com/img/germany.png",
      "country_name": "GERMANY",
      "country_status": "2"
    },
    {
      "country_code": "PLN",
      "countryisocode": "POL",
      "isd_code": "+48",
      "countryisocode2": "PL",
      "country_image": "https://ws.crosspaymt.com/img/poland.jpg",
      "country_name": "POLAND",
      "country_status": "1"
    },
    {
      "country_code": "RON",
      "countryisocode": "ROU",
      "isd_code": "+40",
      "countryisocode2": "RO",
      "country_image": "https://ws.crosspaymt.com/img/romania.png",
      "country_name": "ROMANIA",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "ITA",
      "isd_code": "+39",
      "countryisocode2": "IT",
      "country_image": "https://ws.crosspaymt.com/img/italy.jpg",
      "country_name": "ITALY",
      "country_status": "2"
    },
    {
      "country_code": "EUR",
      "countryisocode": "FRA",
      "isd_code": "+33",
      "countryisocode2": "FR",
      "country_image": "https://ws.crosspaymt.com/img/france.jpg",
      "country_name": "FRANCE",
      "country_status": "2"
    },
    {
      "country_code": "EUR",
      "countryisocode": "NLD",
      "isd_code": "+31",
      "countryisocode2": "NL",
      "country_image": "https://ws.crosspaymt.com/img/netherland.png",
      "country_name": "NETHERLANDS",
      "country_status": "2"
    },
    {
      "country_code": "EUR",
      "countryisocode": "AUT",
      "isd_code": "+43",
      "countryisocode2": "AT",
      "country_image": "https://ws.crosspaymt.com/img/austria.png",
      "country_name": "AUSTRIA",
      "country_status": "2"
    },
    {
      "country_code": "EUR",
      "countryisocode": "BEL",
      "isd_code": "+32",
      "countryisocode2": "BE",
      "country_image": "https://ws.crosspaymt.com/img/belgium.png",
      "country_name": "BELGIUM",
      "country_status": "2"
    },
    {
      "country_code": "BGN",
      "countryisocode": "BGR",
      "isd_code": "+359",
      "countryisocode2": "BG",
      "country_image": "https://ws.crosspaymt.com/img/bulgaria.png",
      "country_name": "BULGARIA",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "CYP",
      "isd_code": "+357",
      "countryisocode2": "CY",
      "country_image": "https://ws.crosspaymt.com/img/cyprus.jpg",
      "country_name": "CYPRUS",
      "country_status": "1"
    },
    {
      "country_code": "CZK",
      "countryisocode": "CZE",
      "isd_code": "+420",
      "countryisocode2": "CZ",
      "country_image": "https://ws.crosspaymt.com/img/czechrepublic.png",
      "country_name": "CZECH REPUBLIC",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "EST",
      "isd_code": "+372",
      "countryisocode2": "EE",
      "country_image": "https://ws.crosspaymt.com/img/estonia.png",
      "country_name": "ESTONIA",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "FIN",
      "isd_code": "+358",
      "countryisocode2": "FI",
      "country_image": "https://ws.crosspaymt.com/img/finland.png",
      "country_name": "FINLAND",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "GRC",
      "isd_code": "+30",
      "countryisocode2": "GR",
      "country_image": "https://ws.crosspaymt.com/img/greece.png",
      "country_name": "GREECE",
      "country_status": "1"
    },
    {
      "country_code": "HUF",
      "countryisocode": "HUN",
      "isd_code": "+36",
      "countryisocode2": "HU",
      "country_image": "https://ws.crosspaymt.com/img/hungary.png",
      "country_name": "HUNGARY",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "LVA",
      "isd_code": "+371",
      "countryisocode2": "LV",
      "country_image": "https://ws.crosspaymt.com/img/latvia.png",
      "country_name": "LATVIA",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "LTU",
      "isd_code": "+370",
      "countryisocode2": "LT",
      "country_image": "https://ws.crosspaymt.com/img/lithuania.png",
      "country_name": "LITHUANIA",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "LUX",
      "isd_code": "+352",
      "countryisocode2": "LU",
      "country_image": "https://ws.crosspaymt.com/img/luxembroug.png",
      "country_name": "LUXEMBOURG",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "MAL",
      "isd_code": "+356",
      "countryisocode2": "MT",
      "country_image": "https://ws.crosspaymt.com/img/malta.png",
      "country_name": "MALTA",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "PRT",
      "isd_code": "+351",
      "countryisocode2": "PT",
      "country_image": "https://ws.crosspaymt.com/img/portugal.png",
      "country_name": "PORTUGAL",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "SVK",
      "isd_code": "+421",
      "countryisocode2": "SK",
      "country_image": "https://ws.crosspaymt.com/img/slovakia.png",
      "country_name": "SLOVAKIA",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "SVN",
      "isd_code": "+386",
      "countryisocode2": "SI",
      "country_image": "https://ws.crosspaymt.com/img/sloneia.png",
      "country_name": "SLOVENIA",
      "country_status": "1"
    },
    {
      "country_code": "EUR",
      "countryisocode": "ESP",
      "isd_code": "+34",
      "countryisocode2": "ES",
      "country_image": "https://ws.crosspaymt.com/img/spain.png",
      "country_name": "SPAIN",
      "country_status": "2"
    },
    {
      "country_code": "EUR",
      "countryisocode": "IRL",
      "isd_code": "+353",
      "countryisocode2": "IE",
      "country_image": "https://ws.crosspaymt.com/img/ireland.png",
      "country_name": "IRELAND",
      "country_status": "2"
    },
    {
      "country_code": "PKR",
      "countryisocode": "PAK",
      "isd_code": "+92",
      "countryisocode2": "PK",
      "country_image": "https://ws.crosspaymt.com/img/pakistan.png",
      "country_name": "PAKISTAN",
      "country_status": "1"
    },
    {
      "country_code": "AUD",
      "countryisocode": "AUS",
      "isd_code": "+61",
      "countryisocode2": "AU",
      "country_image": "https://ws.crosspaymt.com/img/australia.png",
      "country_name": "AUSTRALIA",
      "country_status": "1"
    },
    {
      "country_code": "LKR",
      "countryisocode": "LKA",
      "isd_code": "+94",
      "countryisocode2": "LK",
      "country_image": "https://ws.crosspaymt.com/img/australia.png",
      "country_name": "SRI LANKA",
      "country_status": "1"
    },
    {
      "country_code": "SEK",
      "countryisocode": "SWE",
      "isd_code": "+46",
      "countryisocode2": "SE",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "SWEDEN",
      "country_status": "2"
    },
    {
      "country_code": "DKK",
      "countryisocode": "DNK",
      "isd_code": "+45",
      "countryisocode2": "DK",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "DENMARK",
      "country_status": "2"
    },
    {
      "country_code": "NPR",
      "countryisocode": "NPL",
      "isd_code": "+977",
      "countryisocode2": "NP",
      "country_image": "https://ws.crosspaymt.com/img/nepal.jpg",
      "country_name": "NEPAL",
      "country_status": "1"
    },
    {
      "country_code": "VND",
      "countryisocode": "VNM",
      "isd_code": "+84",
      "countryisocode2": "VN",
      "country_image": "https://ws.crosspaymt.com/img/vietnam.jpg",
      "country_name": "VIETNAM",
      "country_status": "1"
    },
    {
      "country_code": "SLL",
      "countryisocode": "SLE",
      "isd_code": "+232",
      "countryisocode2": "SL",
      "country_image": "https://ws.crosspaymt.com/img/sll.png",
      "country_name": "SIERRA LEONE",
      "country_status": "1"
    },
    {
      "country_code": "CAD",
      "countryisocode": "CAN",
      "isd_code": "+1",
      "countryisocode2": "CD",
      "country_image": "https://ws.crosspaymt.com/img/canada.png",
      "country_name": "CANADA",
      "country_status": "1"
    },
    {
      "country_code": "GMD",
      "countryisocode": "GMB",
      "isd_code": "+220",
      "countryisocode2": "GM",
      "country_image": "https://ws.crosspaymt.com/img/gambia.jpg",
      "country_name": "GAMBIA",
      "country_status": "1"
    },
    {
      "country_code": "AED",
      "countryisocode": "ARE",
      "isd_code": "+971",
      "countryisocode2": "AE",
      "country_image": "https://ws.crosspaymt.com/img/UNITED-ARAB-EMIRATES.png",
      "country_name": "UNITED ARAB EMIRATES",
      "country_status": "1"
    },
    {
      "country_code": "SGD",
      "countryisocode": "SGP",
      "isd_code": "+65",
      "countryisocode2": "SG",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "SINGAPORE",
      "country_status": "1"
    },
    {
      "country_code": "HKD",
      "countryisocode": "HKG",
      "isd_code": "+852",
      "countryisocode2": "HK",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "HONG KONG",
      "country_status": "1"
    },
    {
      "country_code": "THB",
      "countryisocode": "THA",
      "isd_code": "+66",
      "countryisocode2": "TH",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "THAILAND",
      "country_status": "1"
    },
    {
      "country_code": "CNY",
      "countryisocode": "CHN",
      "isd_code": "+86",
      "countryisocode2": "CN",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "CHINA",
      "country_status": "1"
    },
    {
      "country_code": "ILS",
      "countryisocode": "ISR",
      "isd_code": "+972",
      "countryisocode2": "IL",
      "country_image": "https://ws.crosspaymt.com/img/ISRAEL.png",
      "country_name": "ISRAEL",
      "country_status": "1"
    },
    {
      "country_code": "JPY",
      "countryisocode": "JPN",
      "isd_code": "+81",
      "countryisocode2": "JP",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "JAPAN",
      "country_status": "1"
    },
    {
      "country_code": "KWD",
      "countryisocode": "KWT",
      "isd_code": "+965",
      "countryisocode2": "KW",
      "country_image": "https://ws.crosspaymt.com/img/KUWAIT.png",
      "country_name": "KUWAIT",
      "country_status": "1"
    },
    {
      "country_code": "MXN",
      "countryisocode": "MEX",
      "isd_code": "+52",
      "countryisocode2": "MX",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "MEXICO",
      "country_status": "1"
    },
    {
      "country_code": "NZD",
      "countryisocode": "NZL",
      "isd_code": "+64",
      "countryisocode2": "NZ",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "NEW ZEALAND",
      "country_status": "1"
    },
    {
      "country_code": "OMR",
      "countryisocode": "OMN",
      "isd_code": "+968",
      "countryisocode2": "OM",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "OMAN",
      "country_status": "1"
    },
    {
      "country_code": "QAR",
      "countryisocode": "QAT",
      "isd_code": "+974",
      "countryisocode2": "QA",
      "country_image": "https://ws.crosspaymt.com/img/QATAR.png",
      "country_name": "QATAR",
      "country_status": "1"
    },
    {
      "country_code": "SAR",
      "countryisocode": "SAU",
      "isd_code": "+966",
      "countryisocode2": "SA",
      "country_image": "https://ws.crosspaymt.com/img/SAUDI-ARABIA,.png",
      "country_name": "SAUDI ARABIA",
      "country_status": "1"
    },
    {
      "country_code": "ZAR",
      "countryisocode": "ZAF",
      "isd_code": "+27",
      "countryisocode2": "ZA",
      "country_image": "https://ws.crosspaymt.com/img/gbp.png",
      "country_name": "SOUTH AFRICA",
      "country_status": "1"
    },
    {
      "country_code": "TRY",
      "countryisocode": "TUR",
      "isd_code": "+90",
      "countryisocode2": "TR",
      "country_image": "https://ws.crosspaymt.com/img/TURKEY.png",
      "country_name": "TURKEY",
      "country_status": "1"
    },
    {
      "country_code": "CHF",
      "countryisocode": "CHE",
      "isd_code": "+41",
      "countryisocode2": "CH",
      "country_image": "https://ws.crosspaymt.com/img/SWITZERLAND.png",
      "country_name": "SWITZERLAND",
      "country_status": "1"
    },
    {
      "country_code": "HRK",
      "countryisocode": "HRV",
      "isd_code": "+385",
      "countryisocode2": "HR",
      "country_image": "https://ws.crosspaymt.com/img/CROATIA.png",
      "country_name": "CROATIA",
      "country_status": "1"
    },
    {
      "country_code": "BHD",
      "countryisocode": "BHR",
      "isd_code": "+973",
      "countryisocode2": "BH",
      "country_image": "https://ws.crosspaymt.com/img/BAHRAIN.png",
      "country_name": "BAHRAIN",
      "country_status": "1"
    }
  ],
  "message": "Success",
  "status": "200"
}


VolleySpinnerActivity.java

 package hemanth.smartkit.com.Activity;  
 import android.app.ProgressDialog;  
 import android.content.Context;  
 import android.os.AsyncTask;  
 import android.support.v7.app.AppCompatActivity;  
 import android.os.Bundle;  
 import android.util.Log;  
 import android.view.View;  
 import android.view.inputmethod.InputMethodManager;  
 import android.widget.AdapterView;  
 import android.widget.Spinner;  
 import com.android.volley.Request;  
 import com.android.volley.RequestQueue;  
 import com.android.volley.Response;  
 import com.android.volley.VolleyError;  
 import com.android.volley.toolbox.StringRequest;  
 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.Collections;  
 import java.util.Comparator;  
 import java.util.Timer;  
 import java.util.TimerTask;  
 import hemanth.smartkit.com.Adapter.FlagSpinnerDropDownAdapter;  
 import hemanth.smartkit.com.Bean.FlagSpinnerBean;  
 import hemanth.smartkit.com.R;  
 public class VolleySpinnerActivity extends AppCompatActivity {  
   Spinner TopSpinner, BottomSpinner;  
   private ProgressDialog mprocessingdialog;  
   RequestQueue requestQueue;  
   FlagSpinnerDropDownAdapter CustomListAdapter;  
   ArrayList<String> Topspinnerarray = new ArrayList<>();  
   ArrayList<String> Bottomspinnerarray = new ArrayList<>();  
   final ArrayList<FlagSpinnerBean> data1 = new ArrayList<FlagSpinnerBean>();  
   final ArrayList<FlagSpinnerBean> data2 = new ArrayList<FlagSpinnerBean>();  
   @Override  
   protected void onCreate(Bundle savedInstanceState) {  
     super.onCreate(savedInstanceState);  
     setContentView(R.layout.activity_volley_spinner);  
     InItUi();  
     ActionUi();  
     new VolleySpinnerActivity.GetFlagsAsync().execute();  
   }  
   private void InItUi() {  
     TopSpinner = (Spinner)findViewById(R.id.TopSpinner);  
     BottomSpinner = (Spinner)findViewById(R.id.BottomSpinner);  
   }  
   private void ActionUi() {  
     Topspinnerarray.add("NORWAY");  
     Topspinnerarray.add("UNITED KINGDOM");  
     Bottomspinnerarray.add("AUSTRALIA");  
     Bottomspinnerarray.add("AUSTRIA");  
   }  
   private class GetFlagsAsync extends AsyncTask<Void, Void, Void> {  
     @Override  
     protected void onPreExecute() {  
       // TODO Auto-generated method stub  
       super.onPreExecute();  
       mprocessingdialog = new ProgressDialog(VolleySpinnerActivity.this);  
       mprocessingdialog.setTitle("Please Wait..");  
       mprocessingdialog.setMessage("Loading");  
       mprocessingdialog.setIndeterminate(true);  
       mprocessingdialog.setCancelable(false);  
       mprocessingdialog.show();  
     }  
     @Override  
     protected Void doInBackground(Void... arg0) {  
       StringRequest stringRequest = new StringRequest(Request.Method.GET, "http://54.244.96.209:8080/Crosspaydevelopment/upload/getCountry",  
           new Response.Listener<String>() {  
             @Override  
             public void onResponse(String response) {  
               Log.e("rlog", "response" + response);  
               response = "{\n" +  
                   " \"country\": [\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"GBP\",\n" +  
                   "   \"countryisocode\": \"GBR\",\n" +  
                   "   \"isd_code\": \"+44\",\n" +  
                   "   \"countryisocode2\": \"UK\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"UNITED KINGDOM\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"INR\",\n" +  
                   "   \"countryisocode\": \"IND\",\n" +  
                   "   \"isd_code\": \"+91\",\n" +  
                   "   \"countryisocode2\": \"IN\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/inr.png\",\n" +  
                   "   \"country_name\": \"INDIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"PHP\",\n" +  
                   "   \"countryisocode\": \"PHL\",\n" +  
                   "   \"isd_code\": \"+63\",\n" +  
                   "   \"countryisocode2\": \"PH\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/php.png\",\n" +  
                   "   \"country_name\": \"PHILIPPINES\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"USD\",\n" +  
                   "   \"countryisocode\": \"USA\",\n" +  
                   "   \"isd_code\": \"+1\",\n" +  
                   "   \"countryisocode2\": \"US\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/us.png\",\n" +  
                   "   \"country_name\": \"UNITED STATES\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"NOK\",\n" +  
                   "   \"countryisocode\": \"NOR\",\n" +  
                   "   \"isd_code\": \"+47\",\n" +  
                   "   \"countryisocode2\": \"NO\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/nok.jpg\",\n" +  
                   "   \"country_name\": \"NORWAY\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"DEU\",\n" +  
                   "   \"isd_code\": \"+49\",\n" +  
                   "   \"countryisocode2\": \"DE\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/germany.png\",\n" +  
                   "   \"country_name\": \"GERMANY\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"PLN\",\n" +  
                   "   \"countryisocode\": \"POL\",\n" +  
                   "   \"isd_code\": \"+48\",\n" +  
                   "   \"countryisocode2\": \"PL\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/poland.jpg\",\n" +  
                   "   \"country_name\": \"POLAND\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"RON\",\n" +  
                   "   \"countryisocode\": \"ROU\",\n" +  
                   "   \"isd_code\": \"+40\",\n" +  
                   "   \"countryisocode2\": \"RO\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/romania.png\",\n" +  
                   "   \"country_name\": \"ROMANIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"ITA\",\n" +  
                   "   \"isd_code\": \"+39\",\n" +  
                   "   \"countryisocode2\": \"IT\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/italy.jpg\",\n" +  
                   "   \"country_name\": \"ITALY\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"FRA\",\n" +  
                   "   \"isd_code\": \"+33\",\n" +  
                   "   \"countryisocode2\": \"FR\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/france.jpg\",\n" +  
                   "   \"country_name\": \"FRANCE\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"NLD\",\n" +  
                   "   \"isd_code\": \"+31\",\n" +  
                   "   \"countryisocode2\": \"NL\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/netherland.png\",\n" +  
                   "   \"country_name\": \"NETHERLANDS\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"AUT\",\n" +  
                   "   \"isd_code\": \"+43\",\n" +  
                   "   \"countryisocode2\": \"AT\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/austria.png\",\n" +  
                   "   \"country_name\": \"AUSTRIA\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"BEL\",\n" +  
                   "   \"isd_code\": \"+32\",\n" +  
                   "   \"countryisocode2\": \"BE\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/belgium.png\",\n" +  
                   "   \"country_name\": \"BELGIUM\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"BGN\",\n" +  
                   "   \"countryisocode\": \"BGR\",\n" +  
                   "   \"isd_code\": \"+359\",\n" +  
                   "   \"countryisocode2\": \"BG\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/bulgaria.png\",\n" +  
                   "   \"country_name\": \"BULGARIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"CYP\",\n" +  
                   "   \"isd_code\": \"+357\",\n" +  
                   "   \"countryisocode2\": \"CY\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/cyprus.jpg\",\n" +  
                   "   \"country_name\": \"CYPRUS\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"CZK\",\n" +  
                   "   \"countryisocode\": \"CZE\",\n" +  
                   "   \"isd_code\": \"+420\",\n" +  
                   "   \"countryisocode2\": \"CZ\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/czechrepublic.png\",\n" +  
                   "   \"country_name\": \"CZECH REPUBLIC\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"EST\",\n" +  
                   "   \"isd_code\": \"+372\",\n" +  
                   "   \"countryisocode2\": \"EE\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/estonia.png\",\n" +  
                   "   \"country_name\": \"ESTONIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"FIN\",\n" +  
                   "   \"isd_code\": \"+358\",\n" +  
                   "   \"countryisocode2\": \"FI\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/finland.png\",\n" +  
                   "   \"country_name\": \"FINLAND\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"GRC\",\n" +  
                   "   \"isd_code\": \"+30\",\n" +  
                   "   \"countryisocode2\": \"GR\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/greece.png\",\n" +  
                   "   \"country_name\": \"GREECE\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"HUF\",\n" +  
                   "   \"countryisocode\": \"HUN\",\n" +  
                   "   \"isd_code\": \"+36\",\n" +  
                   "   \"countryisocode2\": \"HU\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/hungary.png\",\n" +  
                   "   \"country_name\": \"HUNGARY\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"LVA\",\n" +  
                   "   \"isd_code\": \"+371\",\n" +  
                   "   \"countryisocode2\": \"LV\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/latvia.png\",\n" +  
                   "   \"country_name\": \"LATVIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"LTU\",\n" +  
                   "   \"isd_code\": \"+370\",\n" +  
                   "   \"countryisocode2\": \"LT\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/lithuania.png\",\n" +  
                   "   \"country_name\": \"LITHUANIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"LUX\",\n" +  
                   "   \"isd_code\": \"+352\",\n" +  
                   "   \"countryisocode2\": \"LU\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/luxembroug.png\",\n" +  
                   "   \"country_name\": \"LUXEMBOURG\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"MAL\",\n" +  
                   "   \"isd_code\": \"+356\",\n" +  
                   "   \"countryisocode2\": \"MT\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/malta.png\",\n" +  
                   "   \"country_name\": \"MALTA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"PRT\",\n" +  
                   "   \"isd_code\": \"+351\",\n" +  
                   "   \"countryisocode2\": \"PT\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/portugal.png\",\n" +  
                   "   \"country_name\": \"PORTUGAL\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"SVK\",\n" +  
                   "   \"isd_code\": \"+421\",\n" +  
                   "   \"countryisocode2\": \"SK\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/slovakia.png\",\n" +  
                   "   \"country_name\": \"SLOVAKIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"SVN\",\n" +  
                   "   \"isd_code\": \"+386\",\n" +  
                   "   \"countryisocode2\": \"SI\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/sloneia.png\",\n" +  
                   "   \"country_name\": \"SLOVENIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"ESP\",\n" +  
                   "   \"isd_code\": \"+34\",\n" +  
                   "   \"countryisocode2\": \"ES\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/spain.png\",\n" +  
                   "   \"country_name\": \"SPAIN\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"EUR\",\n" +  
                   "   \"countryisocode\": \"IRL\",\n" +  
                   "   \"isd_code\": \"+353\",\n" +  
                   "   \"countryisocode2\": \"IE\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/ireland.png\",\n" +  
                   "   \"country_name\": \"IRELAND\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"PKR\",\n" +  
                   "   \"countryisocode\": \"PAK\",\n" +  
                   "   \"isd_code\": \"+92\",\n" +  
                   "   \"countryisocode2\": \"PK\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/pakistan.png\",\n" +  
                   "   \"country_name\": \"PAKISTAN\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"AUD\",\n" +  
                   "   \"countryisocode\": \"AUS\",\n" +  
                   "   \"isd_code\": \"+61\",\n" +  
                   "   \"countryisocode2\": \"AU\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/australia.png\",\n" +  
                   "   \"country_name\": \"AUSTRALIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"LKR\",\n" +  
                   "   \"countryisocode\": \"LKA\",\n" +  
                   "   \"isd_code\": \"+94\",\n" +  
                   "   \"countryisocode2\": \"LK\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/australia.png\",\n" +  
                   "   \"country_name\": \"SRI LANKA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"SEK\",\n" +  
                   "   \"countryisocode\": \"SWE\",\n" +  
                   "   \"isd_code\": \"+46\",\n" +  
                   "   \"countryisocode2\": \"SE\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"SWEDEN\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"DKK\",\n" +  
                   "   \"countryisocode\": \"DNK\",\n" +  
                   "   \"isd_code\": \"+45\",\n" +  
                   "   \"countryisocode2\": \"DK\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"DENMARK\",\n" +  
                   "   \"country_status\": \"2\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"NPR\",\n" +  
                   "   \"countryisocode\": \"NPL\",\n" +  
                   "   \"isd_code\": \"+977\",\n" +  
                   "   \"countryisocode2\": \"NP\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/nepal.jpg\",\n" +  
                   "   \"country_name\": \"NEPAL\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"VND\",\n" +  
                   "   \"countryisocode\": \"VNM\",\n" +  
                   "   \"isd_code\": \"+84\",\n" +  
                   "   \"countryisocode2\": \"VN\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/vietnam.jpg\",\n" +  
                   "   \"country_name\": \"VIETNAM\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"SLL\",\n" +  
                   "   \"countryisocode\": \"SLE\",\n" +  
                   "   \"isd_code\": \"+232\",\n" +  
                   "   \"countryisocode2\": \"SL\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/sll.png\",\n" +  
                   "   \"country_name\": \"SIERRA LEONE\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"CAD\",\n" +  
                   "   \"countryisocode\": \"CAN\",\n" +  
                   "   \"isd_code\": \"+1\",\n" +  
                   "   \"countryisocode2\": \"CD\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/canada.png\",\n" +  
                   "   \"country_name\": \"CANADA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"GMD\",\n" +  
                   "   \"countryisocode\": \"GMB\",\n" +  
                   "   \"isd_code\": \"+220\",\n" +  
                   "   \"countryisocode2\": \"GM\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gambia.jpg\",\n" +  
                   "   \"country_name\": \"GAMBIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"AED\",\n" +  
                   "   \"countryisocode\": \"ARE\",\n" +  
                   "   \"isd_code\": \"+971\",\n" +  
                   "   \"countryisocode2\": \"AE\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/UNITED-ARAB-EMIRATES.png\",\n" +  
                   "   \"country_name\": \"UNITED ARAB EMIRATES\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"SGD\",\n" +  
                   "   \"countryisocode\": \"SGP\",\n" +  
                   "   \"isd_code\": \"+65\",\n" +  
                   "   \"countryisocode2\": \"SG\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"SINGAPORE\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"HKD\",\n" +  
                   "   \"countryisocode\": \"HKG\",\n" +  
                   "   \"isd_code\": \"+852\",\n" +  
                   "   \"countryisocode2\": \"HK\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"HONG KONG\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"THB\",\n" +  
                   "   \"countryisocode\": \"THA\",\n" +  
                   "   \"isd_code\": \"+66\",\n" +  
                   "   \"countryisocode2\": \"TH\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"THAILAND\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"CNY\",\n" +  
                   "   \"countryisocode\": \"CHN\",\n" +  
                   "   \"isd_code\": \"+86\",\n" +  
                   "   \"countryisocode2\": \"CN\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"CHINA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"ILS\",\n" +  
                   "   \"countryisocode\": \"ISR\",\n" +  
                   "   \"isd_code\": \"+972\",\n" +  
                   "   \"countryisocode2\": \"IL\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/ISRAEL.png\",\n" +  
                   "   \"country_name\": \"ISRAEL\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"JPY\",\n" +  
                   "   \"countryisocode\": \"JPN\",\n" +  
                   "   \"isd_code\": \"+81\",\n" +  
                   "   \"countryisocode2\": \"JP\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"JAPAN\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"KWD\",\n" +  
                   "   \"countryisocode\": \"KWT\",\n" +  
                   "   \"isd_code\": \"+965\",\n" +  
                   "   \"countryisocode2\": \"KW\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/KUWAIT.png\",\n" +  
                   "   \"country_name\": \"KUWAIT\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"MXN\",\n" +  
                   "   \"countryisocode\": \"MEX\",\n" +  
                   "   \"isd_code\": \"+52\",\n" +  
                   "   \"countryisocode2\": \"MX\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"MEXICO\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"NZD\",\n" +  
                   "   \"countryisocode\": \"NZL\",\n" +  
                   "   \"isd_code\": \"+64\",\n" +  
                   "   \"countryisocode2\": \"NZ\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"NEW ZEALAND\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"OMR\",\n" +  
                   "   \"countryisocode\": \"OMN\",\n" +  
                   "   \"isd_code\": \"+968\",\n" +  
                   "   \"countryisocode2\": \"OM\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"OMAN\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"QAR\",\n" +  
                   "   \"countryisocode\": \"QAT\",\n" +  
                   "   \"isd_code\": \"+974\",\n" +  
                   "   \"countryisocode2\": \"QA\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/QATAR.png\",\n" +  
                   "   \"country_name\": \"QATAR\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"SAR\",\n" +  
                   "   \"countryisocode\": \"SAU\",\n" +  
                   "   \"isd_code\": \"+966\",\n" +  
                   "   \"countryisocode2\": \"SA\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/SAUDI-ARABIA,.png\",\n" +  
                   "   \"country_name\": \"SAUDI ARABIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"ZAR\",\n" +  
                   "   \"countryisocode\": \"ZAF\",\n" +  
                   "   \"isd_code\": \"+27\",\n" +  
                   "   \"countryisocode2\": \"ZA\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/gbp.png\",\n" +  
                   "   \"country_name\": \"SOUTH AFRICA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"TRY\",\n" +  
                   "   \"countryisocode\": \"TUR\",\n" +  
                   "   \"isd_code\": \"+90\",\n" +  
                   "   \"countryisocode2\": \"TR\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/TURKEY.png\",\n" +  
                   "   \"country_name\": \"TURKEY\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"CHF\",\n" +  
                   "   \"countryisocode\": \"CHE\",\n" +  
                   "   \"isd_code\": \"+41\",\n" +  
                   "   \"countryisocode2\": \"CH\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/SWITZERLAND.png\",\n" +  
                   "   \"country_name\": \"SWITZERLAND\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"HRK\",\n" +  
                   "   \"countryisocode\": \"HRV\",\n" +  
                   "   \"isd_code\": \"+385\",\n" +  
                   "   \"countryisocode2\": \"HR\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/CROATIA.png\",\n" +  
                   "   \"country_name\": \"CROATIA\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  },\n" +  
                   "  {\n" +  
                   "   \"country_code\": \"BHD\",\n" +  
                   "   \"countryisocode\": \"BHR\",\n" +  
                   "   \"isd_code\": \"+973\",\n" +  
                   "   \"countryisocode2\": \"BH\",\n" +  
                   "   \"country_image\": \"https://ws.crosspaymt.com/img/BAHRAIN.png\",\n" +  
                   "   \"country_name\": \"BAHRAIN\",\n" +  
                   "   \"country_status\": \"1\"\n" +  
                   "  }\n" +  
                   " ],\n" +  
                   " \"message\": \"Success\",\n" +  
                   " \"status\": \"200\"\n" +  
                   "}";  
               try {  
                 JSONObject jsonObj = new JSONObject(response);  
                 JSONArray jsonArray = jsonObj.getJSONArray("country");  
                 for (int i = 0; i < jsonArray.length(); i++) {  
                   for (int j = 0; j < Topspinnerarray.size(); j++) {  
                     FlagSpinnerBean item = new FlagSpinnerBean();  
                     JSONObject c = jsonArray.getJSONObject(i);  
 //                    if (c.getString("country_name").equals(Topspinnerarray.get(j))) {  
                     if (c.getString("country_status").equals("2")) {  
                       String icon = c.getString("country_image");  
                       item.setCountry_image(icon);  
                       item.setCountry_code(c.optString("country_code"));  
                       item.setCountry_name(c.optString("country_name"));  
                       item.setCountryisocode(c.optString("countryisocode"));  
                       data1.add(item);  
 //                      data0.add(c.getString("country_code"));  
                       break;  
 //                      }  
                     }  
                   }  
                 }  
                 for (int i = 0; i < jsonArray.length(); i++) {  
                   for (int j = 0; j < Bottomspinnerarray.size(); j++) {  
                     FlagSpinnerBean item = new FlagSpinnerBean();  
                     JSONObject c = jsonArray.getJSONObject(i);  
 //                    if (c.getString("country_name").equals(Bottomspinnerarray.get(j))) {  
                     if (c.getString("country_status").equals("1") || c.getString("country_status").equals("2")) {  
                       String icon = c.getString("country_image");  
                       item.setCountry_image(icon);  
                       item.setCountry_code(c.optString("country_code"));  
                       item.setCountry_name(c.optString("country_name"));  
                       item.setCountryisocode(c.optString("countryisocode"));  
                       data2.add(item);  
                       break;  
 //                      }  
                     }  
                   }  
                 }  
 //                ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(MainActivity.this,  
 //                    android.R.layout.select_dialog_item, data0);  
 //                dataAdapter.setDropDownViewResource(android.R.layout.select_dialog_item);  
 //                dataAdapter.notifyDataSetChanged();  
 //                TopSpinner.setAdapter(dataAdapter);  
                 Collections.sort(data1, new Comparator<FlagSpinnerBean>() {  
                   public int compare(FlagSpinnerBean o1, FlagSpinnerBean o2) {  
                     if (o1.getCountry_name() == null || o2.getCountry_name() == null) {  
                       return 0;  
                     }  
                     return o1.getCountry_name().compareToIgnoreCase(o2.getCountry_name());  
                   }  
                 });  
                 CustomListAdapter = new FlagSpinnerDropDownAdapter(VolleySpinnerActivity.this, data1);  
                 TopSpinner.setAdapter(CustomListAdapter);  
 //                Collections.reverse(data1);  
                 TopSpinner.setSelection(11);  
                 TopSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {  
                   @Override  
                   public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {  
                     FlagSpinnerBean c = data1.get(position);  
 //                    PreferncesUtils.saveStringValue(MainActivity.this, PreferncesUtils.FROM_CODE, c.getCountry_code());  
 //                    PreferncesUtils.saveStringValue(MainActivity.this, PreferncesUtils.FROM_COUNTRY, c.getCountry_name());  
 //                    PreferncesUtils.saveStringValue(MainActivity.this, PreferncesUtils.SOURCE_ISO_CODE, c.getCountryisocode());  
 //                  Toast.makeText(getApplicationContext(),c.getCountry_name()+"\n"+c.getCountry_code()+"\n",Toast.LENGTH_SHORT).show();  
 //                    InputMethodManager inputMethodManager = (InputMethodManager)  
 //                        getSystemService(Context.INPUT_METHOD_SERVICE);  
 //                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);  
 //                    Calendar calendar = Calendar.getInstance();  
 //                    SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss ");  
 //                    if(c.getCountry_name().equalsIgnoreCase("United kingdom")){  
 //                      sdf.setTimeZone(TimeZone.getTimeZone("GMT+1"));  
 //                      Log.e("rlog",sdf.format(calendar.getTime()));  
 //                    }else {  
 //  
 //                      sdf.setTimeZone(TimeZone.getTimeZone("GMT+2"));  
 //                      Log.e("rlog",sdf.format(calendar.getTime()));  
 //  
 //                    }  
 //                    if (TopEditText.hasFocus()) {  
 //                      new MainActivity.TopToBottomRateExchangetAsync().execute();  
 //                    } else if (BottomEditText.hasFocus()) {  
 //                      new MainActivity.BottomToTopRateExchangetAsync().execute();  
 //                    } else {  
 //                      new MainActivity.TopToBottomRateExchangetAsync().execute();  
 //                    }  
 //                    new MainActivity.TopToBottomRateExchangetAsync().execute();  
 //                    BottomEditText.requestFocus();  
                   }  
                   @Override  
                   public void onNothingSelected(AdapterView<?> parent) {  
                   }  
                 });  
                 Collections.sort(data2, new Comparator<FlagSpinnerBean>() {  
                   public int compare(FlagSpinnerBean o1, FlagSpinnerBean o2) {  
                     if (o1.getCountry_name() == null || o2.getCountry_name() == null) {  
                       return 0;  
                     }  
                     return o1.getCountry_name().compareToIgnoreCase(o2.getCountry_name());  
                   }  
                 });  
                 CustomListAdapter = new FlagSpinnerDropDownAdapter(VolleySpinnerActivity.this, data2);  
                 BottomSpinner.setAdapter(CustomListAdapter);  
                 BottomSpinner.setSelection(17);  
                 BottomSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {  
                   @Override  
                   public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {  
                     FlagSpinnerBean c = data2.get(position);  
 //                    PreferncesUtils.saveStringValue(MainActivity.this, PreferncesUtils.TO_CODE, c.getCountry_code());  
 //                    PreferncesUtils.saveStringValue(MainActivity.this, PreferncesUtils.TO_COUNTRY, c.getCountry_name());  
 //                    PreferncesUtils.saveStringValue(MainActivity.this, PreferncesUtils.DESTINATION_ISO_CODE, c.getCountryisocode());  
 //                  Toast.makeText(getApplicationContext(),c.getCountry_name()+"\n"+c.getCountry_code()+"\n",Toast.LENGTH_SHORT).show();  
 //                    InputMethodManager inputMethodManager = (InputMethodManager)  
 //                        getSystemService(Context.INPUT_METHOD_SERVICE);  
 //                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);  
 //                    if (TopEditText.hasFocus()) {  
 //                      new MainActivity.TopToBottomRateExchangetAsync().execute();  
 //                    } else if (BottomEditText.hasFocus()) {  
 //                      new MainActivity.BottomToTopRateExchangetAsync().execute();  
 //                    } else {  
 //                      new MainActivity.TopToBottomRateExchangetAsync().execute();  
 //                    }  
 //                    new MainActivity.TopToBottomRateExchangetAsync().execute();  
 //                    TopEditText.requestFocus();  
                   }  
                   @Override  
                   public void onNothingSelected(AdapterView<?> parent) {  
                   }  
                 });  
               } catch (JSONException e) {  
                 e.printStackTrace();  
               } catch (NumberFormatException nfe) {  
                 nfe.printStackTrace();  
                 finish();  
                 startActivity(getIntent());  
               } catch (IllegalStateException e) {  
                 e.printStackTrace();  
                 finish();  
                 startActivity(getIntent());  
               }  
             }  
           }, new Response.ErrorListener() {  
         @Override  
         public void onErrorResponse(VolleyError error) {  
         }  
       });  
       RequestQueue requestQueue = Volley.newRequestQueue(VolleySpinnerActivity.this);  
       requestQueue.add(stringRequest);  
       return null;  
     }  
     @Override  
     protected void onPostExecute(Void result) {  
       // TODO Auto-generated method stub  
       super.onPostExecute(result);  
       new Timer().schedule(new TimerTask() {  
         @Override  
         public void run() {  
           mprocessingdialog.dismiss();  
         }  
       }, 5000);  
     }  
   }  
 } 

FlagSpinnerDropDownAdapter.java


 package hemanth.smartkit.com.Adapter;  
 import android.content.Context;  
 import android.view.LayoutInflater;  
 import android.view.View;  
 import android.view.ViewGroup;  
 import android.widget.BaseAdapter;  
 import android.widget.ImageView;  
 import android.widget.TextView;  
 import com.bumptech.glide.Glide;  
 import java.util.ArrayList;  
 import hemanth.smartkit.com.Bean.FlagSpinnerBean;  
 import hemanth.smartkit.com.R;  
 public class FlagSpinnerDropDownAdapter extends BaseAdapter {  
   Context context;  
   ArrayList<FlagSpinnerBean> data = new ArrayList<FlagSpinnerBean>();  
   LayoutInflater inflter;  
   TextView txt;  
   ImageView icon;  
   public FlagSpinnerDropDownAdapter(Context applicationContext, ArrayList<FlagSpinnerBean> data) {  
     this.context = applicationContext;  
     this.data=data;  
     inflter = (LayoutInflater.from(applicationContext));  
   }  
   public int getCount() {  
     return data.size();  
   }  
   @Override  
   public Object getItem(int i) {  
     return null;  
   }  
   @Override  
   public long getItemId(int i) {  
     return 0;  
   }  
   @Override  
   public View getDropDownView(final int i, View view, final ViewGroup parent) {  
     view = inflter.inflate(R.layout.flag_spinner_list_dropdownview, null);  
      txt = (TextView)view.findViewById(R.id.txt);  
      icon = (ImageView) view.findViewById(R.id.img);  
 //    RadioButton radioButton = (RadioButton) view.findViewById(R.id.radioButton);  
 //    radioButton.setOnClickListener(new View.OnClickListener() {  
 //      @Override  
 //      public void onClick(View v) {  
 //        Log.d("rlog",data.get(i).getCountry_image());  
 //  
 //        txt.setText(data.get(i).getCountry_name());  
 //        Log.d("rlog",data.get(i).getCountry_image());  
 //        Glide.with(context)  
 //            .load(data.get(i).getCountry_image())  
 //            .into(icon);  
 //        ((View) parent.getParent().getParent().getParent().getParent()).setVisibility(View.GONE);  
 //      }  
 //    });  
     //    txt.setTextColor(Color.BLACK);  
     txt.setText(data.get(i).getCountry_name());  
 //    Log.d("rlog",data.get(i).getCountry_image());  
     Glide.with(context).load(data.get(i).getCountry_image()).into(icon);  
     return view;  
   }  
   @Override  
   public View getView(final int i, View view, ViewGroup viewGroup) {  
     view = inflter.inflate(R.layout.flag_spinner_list_single, null);  
     ImageView icon = (ImageView) view.findViewById(R.id.img);  
     TextView txt=(TextView)view.findViewById(R.id.txt);  
     txt.setText(data.get(i).getCountry_code());  
 //    Log.d("rlog",data.get(i).getCountry_image());  
     Glide.with(context).load(data.get(i).getCountry_image()).into(icon);  
     return view;  
   }  
 }  


FlagSpinnerBean.java

 package hemanth.smartkit.com.Bean;  
 public class FlagSpinnerBean {  
   String country_code;  
   String country_name;  
   String country_image;  
   String countryisocode ;  
   public String getCountryisocode() {  
     return countryisocode;  
   }  
   public void setCountryisocode(String countryisocode) {  
     this.countryisocode = countryisocode;  
   }  
   public String getCountry_code() {  
     return country_code;  
   }  
   public void setCountry_code(String country_code) {  
     this.country_code = country_code;  
   }  
   public String getCountry_name() {  
     return country_name;  
   }  
   public void setCountry_name(String country_name) {  
     this.country_name = country_name;  
   }  
   public String getCountry_image() {  
     return country_image;  
   }  
   public void setCountry_image(String country_image) {  
     this.country_image = country_image;  
   }  
 }  



activity_volley_spinner.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.VolleySpinnerActivity">  
   <LinearLayout  
     android:layout_width="match_parent"  
     android:layout_height="wrap_content"  
     android:orientation="vertical">  
     <Spinner  
       android:id="@+id/TopSpinner"  
       android:layout_width="wrap_content"  
       android:layout_height="50dp"  
       android:layout_weight=".5"  
       android:spinnerMode="dialog" />  
     <Spinner  
       android:id="@+id/BottomSpinner"  
       android:layout_width="wrap_content"  
       android:layout_height="50dp"  
       android:layout_weight=".5"  
       android:spinnerMode="dialog" />  
   </LinearLayout>  
 </android.support.constraint.ConstraintLayout>  


flag_spinner_list_single.xml


 <?xml version="1.0" encoding="utf-8"?>  
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
   android:layout_width="match_parent"  
   android:layout_height="match_parent"  
   android:orientation="horizontal"  
   android:gravity="right">  
 <TableRow  
   android:id="@+id/relative"  
   android:layout_width="wrap_content"  
   android:layout_height="wrap_content"  
   android:orientation="horizontal" >  
   <TextView  
     android:id="@+id/txt"  
     android:layout_width="wrap_content"  
     android:layout_height="wrap_content"  
     android:layout_margin="5dp"  
     android:text="GDP"  
     android:textStyle="bold"  
     android:textAllCaps="true"  
     android:textSize="30sp" />  
   <View  
     android:layout_width="2dp"  
     android:layout_height="wrap_content"  
     android:layout_marginRight="5dp"  
     />  
   <ImageView  
     android:id="@+id/img"  
     android:layout_width="70dp"  
     android:layout_margin="5dp"  
     android:layout_height="40dp"  
     />  
 </TableRow>  
 </LinearLayout>  




flag_spinner_list_dropdownview.xml


 <?xml version="1.0" encoding="utf-8"?>  
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
   android:layout_width="match_parent"  
   android:layout_height="match_parent"  
   android:orientation="vertical">  
   <TableRow  
     android:id="@+id/relative"  
     android:layout_width="match_parent"  
     android:layout_height="match_parent"  
     >  
     <!--<RadioButton-->  
     <!--android:id="@+id/radioButton"-->  
     <!--android:layout_width="wrap_content"-->  
     <!--android:layout_height="wrap_content"-->  
     <!--android:layout_margin="5dp"-->  
     <!--/>-->  
     <ImageView  
       android:id="@+id/img"  
       android:layout_width="40dp"  
       android:layout_height="30dp"  
       android:layout_gravity="center"  
       android:layout_margin="5dp"  
       android:cropToPadding="true"  
       android:padding="1dp"  
       android:scaleType="centerCrop" />  
     <TextView  
       android:id="@+id/txt"  
       android:layout_width="wrap_content"  
       android:layout_height="wrap_content"  
       android:layout_gravity="center"  
       android:layout_margin="5dp"  
       android:text="GDP"  
       android:textAllCaps="true"  
       />  
   </TableRow>  
   <!--<TableRow-->  
     <!--android:layout_width="wrap_content"-->  
     <!--android:layout_height="wrap_content">-->  
     <!--<View-->  
       <!--android:layout_width="match_parent"-->  
       <!--android:layout_height="1dp"-->  
       <!--android:background="@color/black" />-->  
   <!--</TableRow>-->  
 </LinearLayout>