title: Android Grid View databind
body: <p>I have my own class arraylist and I need to bind that list and show only some fields to user. I have tried this by creating my own adapter class by extending BaseAdapter class. But I just showed only one field(firstname) I need to show more. here is my adapter class,</p>
  
  <pre><code>private class MyGriAdapter extends BaseAdapter{
  
          ArrayList&lt;Doctor&gt; data;
  
          public MyGriAdapter(ArrayList&lt;Doctor&gt; data){
              this.data = data;
          }
          @Override
          public int getCount() {
              return data.size();
          }
  
          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
              TextView vv = new TextView(getApplicationContext());
              vv.setTextColor(Color.BLACK);
              vv.setText(data.get(position).firstname);
  
              return vv;
          }
  
          @Override
          public Object getItem(int arg0) {
              return data.get(arg0);
          }
  
          @Override
          public long getItemId(int position) {
              return position;
          }
      }
  </code></pre>
  
  <p>and my button click event I'm binding data (doctorResultList is the Doctor type arraylist),</p>
  
  <pre><code>GridView grid_main = (GridView)findViewById(R.id.GridView01);
  MyGriAdapter grdAdapter = new MyGriAdapter(doctorResultList);
  grid_main.setAdapter(grdAdapter);
  </code></pre>