title: NullPointerException in listview of sqlite
body: <p>I Have Class G and ActivityMain. so my problem is in ActivityMain in first line of for loop I gave NullPointerException. of course in genymotion my app work correctly but in avd of eclipse......!i gave that.
  so can anyone help me I so be cheerful:D</p>
  
  <pre><code>public class G extends Application {
  
  public static Context               context;
  public static LayoutInflater        inflater;
  public static Activity              currentActivity;
  public static ArrayList&lt;StructNote&gt; notes        = new ArrayList&lt;StructNote&gt;();
  
  public static SQLiteDatabase        database;
  public static final String          DIR_SDCARD   = Environment.getExternalStorageDirectory().getAbsolutePath();
  public static final String          DIR_DATABASE = DIR_SDCARD + "/database-word/";
  
  public static String                Word;
  public static String                word_mean;
  public static Cursor                cursor;
  public static int                   i            = 0;
  public static String[]              array;
  
  @Override
  public void onCreate() {
      super.onCreate();
      context = getApplicationContext();
      inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      new File(DIR_DATABASE).mkdirs();
  
      database = SQLiteDatabase.openOrCreateDatabase(DIR_DATABASE + "/database.sqlite", null);
      database.execSQL("CREATE  TABLE  IF NOT EXISTS word (" +
              "word_id INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE , " +
              "word TEXT, " +
              "word_mean TEXT)");
  
      cursor = database.rawQuery("SELECT * FROM word", null);
      array = new String[cursor.getCount()];
      while (cursor.moveToNext()) {
  
          Word = cursor.getString(cursor.getColumnIndex("word"));
          word_mean = cursor.getString(cursor.getColumnIndex("word_mean"));
          array[i] = Word;
          i++;
      }
      cursor.close();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>public class ActivityMain extends Activity {</p>
  
  <pre><code>public ArrayAdapter adapter;
  public int          k         = 0;
  
  
  @Override
  protected void onResume() {
      G.currentActivity = this;
      super.onResume();
      if (adapter != null) {
          adapter.notifyDataSetChanged();
      }
  }
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      ListView lstContent = (ListView) findViewById(R.id.lstContent);
  
      adapter = new AdapterNote(G.notes);
      lstContent.setAdapter(adapter);
  
  for (k = 0; k &lt; G.Word.length(); k++) {
          StructNote note = new StructNote();
           note.title = "" +("#" + G.array[k], "#");
           G.notes.add(note);
      }
   adapter.notifyDataSetChanged();
  }
  </code></pre>
  
  <p>}</p>