0

私はこのチュートリアルhttp://www.sarahghaffary.com/android-quotes-generator-sample-application-using-alarmmanager-and-sqlite-database/に従っていますが、どのように繰り返し続けるのか知りたいです引用符がなくなった場合でも引用符を付けます。以下のコードを変更する必要があることはわかっていますが、方法がわかりません。初心者のみ、どんな助けでも素晴らしいでしょう!

コード:

 public String getRandomQuote(){
SQLiteDatabase db = this.getWritableDatabase();
String selectQuery = "SELECT  * FROM " + QUOTES_TABLE_NAME + " WHERE " + KEY_ISREAD + " = 0 ORDER BY RANDOM() LIMIT 1";
Cursor cursor = db.rawQuery(selectQuery, null);

if (cursor != null)
    if(cursor.moveToFirst()){
        db.execSQL("update " + QUOTES_TABLE_NAME + " set " + KEY_ISREAD + " = 1 where "+ KEY_ID +" = "+ cursor.getString(0));
        return cursor.getString(1);
    }
return "Sorry, you ran out of quotes <img src="http://www.sarahghaffary.com/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" class="wp-smiley"> ";
}
4

1 に答える 1