title: Get spinner data from WebService
body: <p>I have created an Android application in that I am calling webservice that have attribute name and attribute value and I wants to display attribute value in Spinner and attribute name display in TextView. If attribute value is two then two arrylist is store. If attribute name is same in both list then store only one list. If attributename change then add new arraylist. Below is my code</p>
  
  <pre><code>//call webservice for product attribute 
  
      private class getCategoryProductAttribute extends AsyncTask&lt;String, String, String&gt; {
              ProgressDialog pdLoading = new ProgressDialog(ProductDescriptionActivity.this);
              StringBuilder result = null;
              String response;
              @Override
              protected void onPreExecute() {
                  super.onPreExecute();
                  pdLoading.setMessage("Loding..");
                  pdLoading.setCancelable(false);
                  pdLoading.show();
              }
  
              @Override
              protected String doInBackground(String... strings) {
                  if (pref.isLoggedIn() == true) {
                      constant_pref.getPrefData();
                  } else {
                      constant_pref.UserName = "remplastic@admin";
                      constant_pref.Password = "remplastic@admin";
                      constant_pref.AppVersion = getVersionInfo();
                      constant_pref.DataVersion = "1.0";
                  }
                  Webservice addressService = new Webservice();
                  String query = "&lt;value&gt;&lt;user_name&gt;" + constant_pref.UserName + "&lt;/user_name&gt;" +
                          "&lt;user_password&gt;" + constant_pref.Password + "&lt;/user_password&gt;" +
                          "&lt;product_id&gt;" + Product_Id + "&lt;/product_id&gt;" +
                          "&lt;appversion_text&gt;" + constant_pref.AppVersion + "&lt;/appversion_text&gt;" +
                          "&lt;dataversion_text&gt;" + constant_pref.DataVersion + "&lt;/dataversion_text&gt;&lt;/value&gt;";
                  try {
                      addressService.XmlPostData(ConstantUrl.Product_Attribute_Url, query);
                      result = addressService.getResponse();
                      response = result.toString();
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
                  return response;
              }
  
              @Override
              protected void onPostExecute(String s) {
                  super.onPostExecute(s);
                  try {
                      if (response.length() &gt; 0) {
                          int code = Integer.parseInt(XMLManualParser.getTagValue(ConstantUrl.TAG_CODE, response));
                          String msg = XMLManualParser.getTagValue("message", response);
                          if (code == 1) {
                              spinnerlist.clear();
                              ArrayList&lt;String&gt; productlist = XMLManualParser.getMultipleTagList(ConstantUrl.TAG_LIST, response);
                              for (int i = 0; i &lt; productlist.size(); ++i) {
                                  String responseContent = productlist.get(i);
                                  HashMap&lt;String, String&gt; hashMap = new HashMap&lt;String, String&gt;();
                                  hashMap.put("attr_name", XMLManualParser.getTagValue(ConstantUrl.attribute_name, responseContent));
                                  hashMap.put("attr_value", XMLManualParser.getTagValue(ConstantUrl.attribute_value, responseContent));
                                  hashMap.put("attr_dealerprize", XMLManualParser.getTagValue(ConstantUrl.product_dealerprice, responseContent));
                                  hashMap.put("attr_retailer_prize", XMLManualParser.getTagValue(ConstantUrl.product_retaillerprice, responseContent));
                                  spinnerlist.add(hashMap);
                                  if (XMLManualParser.getTagValue(ConstantUrl.attribute_name, responseContent).toLowerCase().equalsIgnoreCase("print")) {
  
                                  }
                              }
                              attribute_adapter.notifyDataSetChanged();
                          } else {
                              Toast.makeText(ProductDescriptionActivity.this, msg, Toast.LENGTH_SHORT).show();
                          }
                          attribute_adapter.notifyDataSetChanged();
                      }
                  } catch (Exception e) {
  
                  }
                  pdLoading.dismiss();
              }
          }
  </code></pre>