テキストビューに文字列を表示しようとしています。データベースからコンソールに正常に出力できましたが、すべての文字列をさまざまなテキストビューに出力する方法がわかりません。これが私のコードです:
MainActivity.java
public class MainActivity extends Activity implements OnClickListener {
EditText search;
Button insert;
TextView txt1, txt2, txt3, txt4, txt5;
DatabaseHandler db;
List<History> history;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    db = new DatabaseHandler(this);
    search = (EditText) findViewById(R.id.search_word);
    insert = (Button) findViewById(R.id.insert);
    txt1 = (TextView) findViewById(R.id.txt1);
    txt2 = (TextView) findViewById(R.id.txt2);
    txt3 = (TextView) findViewById(R.id.txt3);
    txt4 = (TextView) findViewById(R.id.txt4);
    txt5 = (TextView) findViewById(R.id.txt5);
    insert.setOnClickListener(this);
    history = db.getAllHistory();
}
public void onClick(View v) {
    db.addHistory(new History(search.getText().toString(), null));
    Toast.makeText(getApplicationContext(),
            "Inserted: " + search.getText().toString(), Toast.LENGTH_LONG)
            .show();
}
@Override
protected void onStart() {
    super.onStart();
    List<History> history = db.getAllHistory();
    for (History cn : history) {
        String log = "Search Strings: " + cn.getName();
        Log.d("Search Strings: ", log);
    }
}
}
これは、 onStart() 関数ですべてのデータベース値を取得する私のアクティビティです。ここで、データベースからのすべてのデータをテキストビューに設定する必要があります。これが、各行を取り出している私の DabaseHandler クラスです。
DatabaseHandler.java
public class DatabaseHandler extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "historyManager";
private static final String TABLE_HISTORY = "histories";
private static final String KEY_NAME = "history";
public DatabaseHandler(Context context) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
    String CREATE_HISTORY_TABLE = "CREATE TABLE " + TABLE_HISTORY + "("
            + KEY_NAME + " TEXT" + ")";
    db.execSQL(CREATE_HISTORY_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // Drop older table if existed
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_HISTORY);
    onCreate(db);
}
void addHistory(History history) {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(KEY_NAME, history.getName());
    db.insert(TABLE_HISTORY, null, values);
    db.close();
}
History getHistory(int id) {
    SQLiteDatabase db = this.getReadableDatabase();
    Cursor cursor = db.query(TABLE_HISTORY, new String[] { KEY_NAME },
            "=?", new String[] { String.valueOf(id) }, null, null, null,
            null);
    if (cursor != null)
        cursor.moveToFirst();
    History history = new History(Integer.parseInt(cursor.getString(0)),
            cursor.getString(1), cursor.getString(2));
    return history;
}
public List<History> getAllHistory() {
    List<History> historyList = new ArrayList<History>();
    String selectQuery = "SELECT  * FROM " + TABLE_HISTORY;
    SQLiteDatabase db = this.getWritableDatabase();
    Cursor cursor = db.rawQuery(selectQuery, null);
    if (cursor.moveToFirst()) {
        do {
            History contact = new History();
            contact.setName(cursor.getString(0));
            historyList.add(contact);
        } while (cursor.moveToNext());
    }
    return historyList;
}
public int updateHistory(History history) {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(KEY_NAME, history.getName());
    return db.update(TABLE_HISTORY, values, KEY_NAME + " = ?",
            new String[] { String.valueOf(history.getName()) });
}
public void deleteHistory(History history) {
    SQLiteDatabase db = this.getWritableDatabase();
    db.delete(TABLE_HISTORY, KEY_NAME + " = ?",
            new String[] { String.valueOf(history.getName()) });
    db.close();
}
public int getHistoryCount() {
    String countQuery = "SELECT  * FROM " + TABLE_HISTORY;
    SQLiteDatabase db = this.getReadableDatabase();
    Cursor cursor = db.rawQuery(countQuery, null);
    cursor.close();
    return cursor.getCount();
}
}
テキストビューにデータを印刷するのを手伝ってください。Log.d では、すべてのデータが次々と送られてくるのを見ることができます。しかし、すべてのデータを印刷することはできません。