title: Array adapter getview shows only last value
body: <p>I am new to android,i am implementing custom listview using array adapter,in my arraylist i am having 10 different values but while i setting this values to listview it displaying only the last view.i am very confusing please clear my doubt</p>
  
  <p>Here is my array adapter</p>
  
  <pre><code>public class GetAllmessageAdapter extends ArrayAdapter&lt;AllMessageObject&gt;{
  
  
  public List&lt;AllMessageObject&gt; marrayOfList;
  public Context context;
  AllMessageObject messageObject;
  int row;
  
  public GetAllmessageAdapter(Context context, int textViewResourceId,
          List&lt;AllMessageObject&gt; arrayOfList) {
      super(context, textViewResourceId,arrayOfList);
      this.marrayOfList = arrayOfList;
      this.context=context;
      this.row=textViewResourceId;
  }
  
   public Context getContext() {
          return context;
      }
  
  public int getCount(){
      return this.marrayOfList.size();
  }
  
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
  //  return super.getView(position, convertView, parent);
      System.out.println("in get view");
      ViewHolder holder;
  
      if(convertView==null){
  
          LayoutInflater Inflator = (LayoutInflater) context
                  .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
          convertView=Inflator.inflate(row, null);
  
          holder = new ViewHolder();
  
          convertView.setTag(holder);
  
      }else
          holder = (ViewHolder) convertView.getTag();
  
      messageObject=marrayOfList.get(position);
  
       holder.user_name = (TextView) convertView.findViewById(R.id.textView1);
       holder.message = (TextView) convertView.findViewById(R.id.textView2);
       holder.from_name = (TextView) convertView.findViewById(R.id.textView4);
       holder.user_img=(ImageView) convertView.findViewById(R.id.imageview1);
  
      if(holder.message!=null &amp;&amp; messageObject.getMessage().length()&gt;0){
          holder.message.setText(messageObject.getMessage());
      }
  
      if(holder.from_name!=null &amp;&amp; messageObject.getFrom_name().length()&gt;0){
          holder.from_name.setText(messageObject.getFrom_name());
      }
  
  //  holder.user_img.setImageResource(R.drawable.fb);
  
      holder.user_name.setText(messageObject.getMessage_date());
  
      return convertView; 
  }
  
   /*private view holder class*/
  public class ViewHolder {
      ImageView user_img;
      TextView user_name;
      TextView message,from_name;
  }
  </code></pre>
  
  <p>Here is how i passing from my activity</p>
  
  <pre><code>protected String doInBackground(String... params) {
          // TODO Auto-generated method stub
  
          System.out.println("background");
          SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
  
          // Use this to add parameters
          request.addProperty("UserId",
                  "fd83ca17-41f5-472a-8efe-7a975d83ed9b");
          request.addProperty("FacebookId", "100006693371290");
          request.addPropertyIfValue("count", "6");
  
          // Declare the version of the SOAP request
          SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                  SoapEnvelope.VER11);
          envelope.setOutputSoapObject(request);
          envelope.dotNet = true;
          try {
  
              HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
              androidHttpTransport.debug = true;
  
              // this is the actual part that will call the webservice
  
              androidHttpTransport.call(SOAP_ACTION1, envelope);
              SoapObject soap_result = (SoapObject) envelope.bodyIn;
              System.out.println("soap_result  " + soap_result);
              result = soap_result.getProperty(0).toString();
              System.out.println("result in message activity " + result);
  
              JSONArray jsonArray = new JSONArray(result);
              int a=jsonArray.length();
              System.out.println("a "+a);
  
              for (int i = 0; i&lt;a ; i++) {
  
                  JSONObject jsonObject = jsonArray.getJSONObject(i);
  
                  messageObject = new AllMessageObject();
  
                  messageObject.setFrom_name(jsonObject.getString(FROM_NAME));
                  System.out.println("jsonObject.getString(FROM_NAME) "+i+" "+jsonObject.getString(FROM_NAME));
                  messageObject.setMessage(jsonObject.getString(MESSAGE));
                  System.out.println("jsonObject.getString(MESSAGE) "+i+" "+jsonObject.getString(MESSAGE));
                  messageObject.setMessage_date(jsonObject.getString(MESSAGE_DATE));
                  System.out.println("jsonObject.getString(MESSAGE_DATE) "+i+" "+jsonObject.getString(MESSAGE_DATE));
              }
  
              arrayOfList.add(messageObject);
  
  
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          return null;
      }
  
      @Override
      protected void onPostExecute(String result) {
          // TODO Auto-generated method stub
          super.onPostExecute(result);
          System.out.println("on post");
  
          adapter=new GetAllmessageAdapter(Woosuite_Message.this, R.layout.list_row, arrayOfList);
          listView.setAdapter(adapter);
  
      }
  </code></pre>
  
  <p>Thank you</p>