title: Passing Sqlite data randomly in notification
body: <p>I'm using prepopulated Sqlite database in my Android app which has three tables (id, word , definition). What i want to do is show a notification to the user randomly from the database. I am doing something like the code below but it is not working.</p>
  
  <p>DatabaseHelper.java</p>
  
  <pre><code>public Cursor getNotification(int id) {
      SQLiteDatabase db = this.getWritableDatabase();
      String Query = "Select * from " + TABLE_DICTIONARY + " where id = " + id  ;
      Cursor cursor = db.rawQuery(Query, null);
      if(cursor.getCount() &lt;= 0){
          cursor.close();
      }
      cursor.close();
      return cursor;
  }
  </code></pre>
  
  <p>And Here is my MainActivity.java</p>
  
  <pre><code>private void showNotification() {
     int position =  dictionaryAdapter.cursor.getPosition();
    int cursorCount = dictionaryAdapter.cursor.getCount();
  
      final int random = new Random().nextInt((cursorCount) - 1);
  
     Cursor i =  mDBHelper.getNotification(random);
      NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this,CHANNEL_ID)
              .setSmallIcon(R.mipmap.ic_launcher)
              .setContentTitle(String.valueOf(i))
              .setPriority(NotificationCompat.PRIORITY_DEFAULT);
  
      NotificationManagerCompat managerCompat = NotificationManagerCompat.from(this);
      managerCompat.notify(1,mBuilder.build());
  
  }
  </code></pre>