title: ListView Using BaseAdapter
body: <p>Sir i am writing a code for listview from my sqlite database using BaseAdapter. I searched a lot but can not find any code like i write. so please help me.
  I have a table MONEY it have four field ID, FIRSTNAME, MONEY, DESCRIPTION.
  I got error in this line : text1.setText(list1[position]);</p>
  
  <pre><code>package com.anurag.main;
  
  import java.util.ArrayList;
  
  import android.app.Activity;
  import android.content.Context;
  import android.database.Cursor;
  import android.database.sqlite.SQLiteDatabase;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.ImageView;
  import android.widget.ListView;
  import android.widget.TextView;
  
  public class Money extends Activity {
  ArrayList list1;
  TextView text1, text2, text3, text4;
  ImageView iv;
  ListView mList;
  SQLiteDatabase db;
  private static String DBNAME = "MainDB.db";
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.money);
      mList = (ListView) findViewById(R.id.mList);
      list1 = new ArrayList();
      try {
          db = openOrCreateDatabase(DBNAME, MODE_WORLD_READABLE, null);
          Cursor c = db.rawQuery("select * from MONEY", null);
          while (c.moveToNext()) {
              list1.add(c.getString(1));
          }
      } catch (Exception e) {
          // TODO: handle exception
      }
      mList.setAdapter(new MyArrayAdapter(getApplicationContext()));
  
  }
  
  class MyArrayAdapter extends BaseAdapter {
      Context context;
  
      public MyArrayAdapter(Context c) {
          context = c;
      }
  
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @Override
      public Object getItem(int position) {
          // TODO Auto-generated method stub
          return null;
      }
  
      @Override
      public long getItemId(int position) {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
          View v = inflater.inflate(R.layout.custom1, null);
          text1 = (TextView) v.findViewById(R.id.text1);
          text1.setText(list1[position]);**// Problem in this line**
          // TODO Auto-generated method stub
          return null;
      }
  
  }
  }
  </code></pre>
  
  <p>Actually i am populating data from my database and want to display in listview. Please let me know if i am writing wrong code.
  Thanks </p>