public class MainActivity extends AppCompatActivity {
private TaskDBHelper helper;
private ListAdapter listAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
private void updateUI(){
helper = new TaskDBHelper(MainActivity.this);
SQLiteDatabase sqlDB = helper.getReadableDatabase();
Cursor cursor = sqlDB.query(TaskContract.TABLE,
new String[]{TaskContract.Columns._ID, TaskContract.Columns.TASK},
null, null, null, null, null);
listAdapter = new SimpleCursorAdapter(
this,
R.layout.task_view,
cursor,
new String[]{TaskContract.Columns.TASK},
new int[]{R.id.taskTextView},
0
);
ListView listView = (ListView) findViewById(R.id.list);
listView.setAdapter(listAdapter);
}
}
}
我不斷收到一個私人無效updateUI()紅色標記顯示預期(分號)表示錯誤消息。OnCreate預計分號在Android工作室
您正在調用方法 – Zaki
updateUi方法實現在oncreate方法 –