title: pass list<data> to custom adapter
body: <p>I have created a list for custom adapter by writing following code:</p>
  
  <pre><code>public class TweetListActivity extends ListActivity {
  
  private ListView tweetListView;
  private ArrayAdapter tweetItemArrayAdapter;
  private final List&lt;Tweet&gt; tweets = new ArrayList&lt;Tweet&gt;();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_tweet_list);
      for (int i = 1; i &lt; 21; i++)
  
      {
          Tweet tweet = new Tweet();
          tweet.setTitle("A nice header for Tweet # " + i);
          tweet.setBody("Some random body text for the tweet # " + i);
          tweets.add(tweet);
      }
      tweetItemArrayAdapter = new TweetAdapter(this,tweets);
  
      setListAdapter(tweetItemArrayAdapter);
  }
  }
  </code></pre>
  
  <p>code for <code>TweetAdapter</code> is as below</p>
  
  <pre><code>public class TweetAdapter extends ArrayAdapter&lt;Tweet&gt; 
  {
      private List&lt;Tweet&gt; tweetslocal;
      private Context context;
      private LayoutInflater inflater;
  
  public TweetAdapter(Activity activity, List&lt;Tweet&gt; tweets) {
      super(activity, R.layout.row_tweet, tweets);
      inflater = activity.getWindow().getLayoutInflater();
      tweetslocal = tweets;
  }
  
  @Override
  public Tweet getItem(int arg0) {
      return tweetslocal.get(arg0);
  }
  
  @Override
  public long getItemId(int arg0) {
      return arg0;
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      View row = inflater.inflate(R.layout.row_tweet, parent, false);
      TextView tweetTitle = (TextView) row.findViewById(R.id.tweetTitle);
      Tweet tweet = tweetslocal.get(position);
      tweetTitle.setText(tweet.getTitle());
      TextView tweetBody = (TextView) row.findViewById(R.id.tweetBody);
      tweetBody.setText(tweet.getBody());
      return row;
  }
  }
  </code></pre>
  
  <p>But, I am not getting the desired output. The list is showing all tweets with header 20 instead of increamental tweets from tweet1 to tweet 20.</p>