title: Error retrieving data from Sqlite Android
body: <p>I'm getting a force close when I try to retrieve data from sqlite db and set it to text views. here's the fetch method:</p>
  
  <pre><code>public ArrayList&lt;Object&gt; getRow() {
  
          ArrayList&lt;Object&gt; list= new ArrayList&lt;Object&gt;();
          Cursor cursor;
          String[] columns={PRIMARY_KEY,COLUMN_NAME,COLUMN_EMAIL,COLUMN_PASSWORD,COLUMN_PASSWORD};
  
  
  
          cursor= sp.query(TABLE_NAME,columns,null,null,null,null,null);
                  int i_id=cursor.getColumnIndex(PRIMARY_KEY);
          int i_name=cursor.getColumnIndex(COLUMN_NAME);
          int i_contact=cursor.getColumnIndex(COLUMN_CONTACT);
          int i_email=cursor.getColumnIndex(COLUMN_EMAIL);
          int i_pass=cursor.getColumnIndex(COLUMN_PASSWORD);
  
  
          for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext())
          {
  
                  list.add(cursor.getLong(i_id));
                  list.add(cursor.getString(i_name));
                  list.add(cursor.getString(i_contact));
                  list.add(cursor.getString(i_email));
                  list.add(cursor.getString(i_pass));
  
          }   
  
  
          return list;
      }
  
  
  }
  </code></pre>
  
  <p>and here is the code to settext, please help me, I tried everything possible, the table does get created and the values are inserted, but fetching doesnt work.</p>
  
  <pre><code>private void getTable() {
  
  
  
  info.open();
      try{
  
      ArrayList&lt;Object&gt; list= info.getRow();
  
      AccBalanceTV.setText((String)list.get(1));
      AccEmailTV.setText((String)list.get(2));
      AccContactTV.setText( (String)list.get(3));
      AccVehTV.setText((String)list.get(4));
      }
      catch(Exception e)
      {
          Toast.makeText(getApplicationContext(), String.valueOf(e), Toast.LENGTH_LONG).show();
      }
      finally{
          info.close();
      }
      }
  </code></pre>
  
  <p>Logcat:</p>
  
  <pre><code>03-09 21:09:46.180: D/dalvikvm(10971): GC_FOR_ALLOC freed 57K, 6% free 12245K/12931K, paused 10ms, total 11ms
  03-09 21:09:46.185: I/dalvikvm-heap(10971): Grow heap (frag case) to 16.032MB for 3686416-byte allocation
  03-09 21:09:46.195: D/dalvikvm(10971): GC_CONCURRENT freed 1K, 5% free 15844K/16583K, paused 1ms+1ms, total 11ms
  03-09 21:09:46.250: D/dalvikvm(10971): GC_FOR_ALLOC freed &lt;1K, 5% free 16873K/17671K, paused 9ms, total 9ms
  03-09 21:09:46.250: I/dalvikvm-heap(10971): Grow heap (frag case) to 18.815MB for 1865972-byte allocation
  03-09 21:09:46.270: D/dalvikvm(10971): GC_CONCURRENT freed &lt;1K, 5% free 18695K/19527K, paused 11ms+2ms, total 21ms
  03-09 21:09:46.315: D/libEGL(10971): loaded /system/lib/egl/libEGL_mali.so
  03-09 21:09:46.320: D/libEGL(10971): loaded /system/lib/egl/libGLESv1_CM_mali.so
  03-09 21:09:46.320: D/libEGL(10971): loaded /system/lib/egl/libGLESv2_mali.so
  03-09 21:09:46.325: D/(10971): Device driver API match
  03-09 21:09:46.325: D/(10971): Device driver API version: 10
  03-09 21:09:46.325: D/(10971): User space API version: 10 
  03-09 21:09:46.325: D/(10971): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Tue Oct 16 15:37:13 KST 2012 
  03-09 21:09:46.350: D/OpenGLRenderer(10971): Enabling debug mode 0
  03-09 21:09:48.205: D/dalvikvm(10971): GC_FOR_ALLOC freed 1041K, 10% free 17741K/19527K, paused 9ms, total 9ms
  03-09 21:09:48.210: I/dalvikvm-heap(10971): Grow heap (frag case) to 21.545MB for 3840016-byte allocation
  03-09 21:09:48.220: D/dalvikvm(10971): GC_CONCURRENT freed 2K, 8% free 21489K/23303K, paused 1ms+1ms, total 12ms
  03-09 21:09:48.415: E/SpannableStringBuilder(10971): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
  03-09 21:09:48.415: E/SpannableStringBuilder(10971): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
  03-09 21:09:56.660: D/AbsListView(10971): Get MotionRecognitionManager
  03-09 21:09:57.990: D/GestureDetector(10971): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 3 mFalseSizeCnt:0
  03-09 21:09:58.135: D/AndroidRuntime(10971): Shutting down VM
  03-09 21:09:58.135: W/dalvikvm(10971): threadid=1: thread exiting with uncaught exception (group=0x411cb2a0)
  03-09 21:09:58.140: E/AndroidRuntime(10971): FATAL EXCEPTION: main
  03-09 21:09:58.140: E/AndroidRuntime(10971): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.miniproject.parkme/com.miniproject.parkme.Account}: java.lang.NullPointerException
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.app.ActivityThread.access$600(ActivityThread.java:140)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.os.Handler.dispatchMessage(Handler.java:99)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.os.Looper.loop(Looper.java:137)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.app.ActivityThread.main(ActivityThread.java:4898)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at java.lang.reflect.Method.invokeNative(Native Method)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at java.lang.reflect.Method.invoke(Method.java:511)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at dalvik.system.NativeStart.main(Native Method)
  03-09 21:09:58.140: E/AndroidRuntime(10971): Caused by: java.lang.NullPointerException
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:228)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at com.miniproject.parkme.databaseManager.&lt;init&gt;(databaseManager.java:40)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at com.miniproject.parkme.Account.&lt;init&gt;(Account.java:12)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at java.lang.Class.newInstanceImpl(Native Method)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at java.lang.Class.newInstance(Class.java:1319)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
  03-09 21:09:58.140: E/AndroidRuntime(10971):    ... 11 more
  03-09 21:10:07.220: I/Process(10971): Sending signal. PID: 10971 SIG: 9
  </code></pre>