数据库.java
public class Data extends SQLiteOpenHelper {
public static String week, classes, title, mat, it, comp, que;
///更常见的代码,如创建、删除数据库
public String[] getAllIAI(){
// Select All Query
String selectQuery = "SELECT * FROM " + TABLE_IAI + "WHERE KEY_week =" +LessonPlanner.itemWeek+ "AND KEY_class=" +LessonPlanner.itemClass ;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor3 = db.rawQuery(selectQuery, null);
String[] data = null;
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
title=cursor.getString(3);
mat=cursor.getString(4);
it=cursor.getString(5);
} while (cursor.moveToNext());
}
// closing connection
cursor.close();
db.close();
// returning lables
return data;
}
推荐.Java
宣布
TextView title, mat, IT;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recomend);
title = (TextView) findViewById(R.id.titleText);
mat = (TextView) findViewById(R.id.materialText);
IT = (TextView) findViewById(R.id.instTText);
title.setText(Data.title);
mat.setText(Data.mat);
IT.setText(Data.it);
我认为代码在某处是错误的,因为 Textview(多行文本)没有显示任何内容。谁能指出我的错误?我对 Eclipse 完全陌生。