title: how to set values in edittext as per spinner selection?
body: <p>I have following response,</p>
  
  <pre><code>{
      "1": {
          "name": "abc",
          "mobile_number": "123456789",
          "address": "streetno3",
          "landmark": "landmarksss",
  
      },
      "2": {
          "name": "def",
          "mobile_number": "123456789",
          "address": "streetno3",
          "landmark": "landmarksss",
  
      },
      "3": {
          "name": "ghi",
          "mobile_number": "23423423234",
          "address": "abcdefgh",
          "landmark": "usa",
  
      },
      "4": {
          "name": "vvb",
          "mobile_number": "55666655",
          "address": "xvgghg",
          "landmark": "fghgh",
  
      },
      "5": {
          "name": "test",
          "mobile_number": "77699231010",
          "address": "pune",
         "landmark": "fghgh",
      }
  }
  </code></pre>
  
  <p>I am getting all the names in <code>spinner</code> till here it works fine,now what im trying is by default i have abc selected, if i select test from spinner then how can i display his details in my <code>edittexts</code>,in short as per name selection i am trying to get and set details in <code>edittext</code></p>
  
  <p>Java code</p>
  
  <pre><code>class LoadAllStates extends AsyncTask&lt;String, String, ArrayList&lt;String&gt;&gt; {
          private ProgressDialog pDialog;
          private String test;
          private String username;
          private String usermobile;
          private String useraddress;
          private String userlandmark;
          private String usercity;
          private String userstate;
          private String userpincode;
          private String useremail;
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              pDialog = new ProgressDialog(ShippingAddress.this.getActivity());
              pDialog.setMessage("Please wait..");
              pDialog.setIndeterminate(true);
              pDialog.setCancelable(true);
              pDialog.show();
          }
  
          protected ArrayList&lt;String&gt; doInBackground(
                  String... args) {
              ServiceHandler sh = new ServiceHandler();
              // Making a request to url and getting response
              statedata = new ArrayList&lt;String&gt;();
              dispdata= new ArrayList&lt;String&gt;();
  
              String jsonStr = sh.makeServiceCall(GET_ADDRESS_DETAIL, ServiceHandler.GET);
              Log.d("Response: ", "&gt; " + jsonStr);
              if (jsonStr != null) {
                  try {
  
                      jsonObj = new JSONObject(jsonStr);
                      for (int i = 1; i &lt;= jsonObj.length(); i++) {
  
                          JSONObject user = jsonObj.getJSONObject(""+i);
                          username= (user.has("name")) ? user.getString("name") : null;
  
                          usermobile= (user.has("mobile_number")) ? user.getString("mobile_number") : null;
                          useraddress= (user.has("address")) ? user.getString("address") : null;
                          userlandmark= (user.has("landmark")) ? user.getString("landmark") : null;
                          usercity= (user.has("city")) ? user.getString("city") : null;
                          userstate= (user.has("state")) ? user.getString("state") : null;
                          userpincode= (user.has("pin_code")) ? user.getString("pin_code") : null;
                          useremail= (user.has("email")) ? user.getString("email") : null;
  
  
                          if(username!=null) statedata.add(username+","+usermobile);
                         /* if(username!=null) dispdata.add(username);
  
                          if(usermobile!=null) dispdata.add(usermobile);*/
  
  
                          Log.i("inner",user.toString());
                          }
                      System.out.println("WifeBday"+statedata.size());
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              } else {
                  Log.e("ServiceHandler", "Couldn't get any data from the url");
              }
              return statedata;
          }
  
          protected void onPostExecute(ArrayList&lt;String&gt; result) {
              super.onPostExecute(result);
              pDialog.dismiss();
              arrallstates = new String[statedata.size()]; // you can also use "result" array instead
              for (int index = 0; index &lt; statedata.size(); index++) {
                  arrallstates[index] = statedata.get(index);// or result.get(index);
              }
              // pass arrConuntry array to ArrayAdapter&lt;String&gt; constroctor :
              adapterallstates = new ArrayAdapter&lt;String&gt;(
                      ShippingAddress.this.getActivity(),
                      android.R.layout.simple_spinner_dropdown_item, arrallstates);
              System.out.println("adpttest"+adapterallstates);
              spiner.setAdapter(adapterallstates);
  
              spiner.setOnItemSelectedListener(new OnItemSelectedListener() {
  
                  @Override
                  public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                      // TODO Auto-generated method stub
  
                      /*String abc=statedata.get(position);
                      System.out.println("abc"+abc);*/
                        edtname.setText(username);
                          edtmobile.setText(usermobile);
                          edtlandmark.setText(userlandmark);
                          edtemail.setText(useremail);
                          edtcity.setText(usercity);
                          edtstate.setText(userstate);
                          edtaddress.setText(useraddress);
                          edtpincode.setText(userpincode);
                  }
  
                  @Override
                  public void onNothingSelected(AdapterView&lt;?&gt; parent) {
                      // TODO Auto-generated method stub
  
                  }
              });
  
          }
          }
  </code></pre>