I have the following code that successfully updates parts of my layout from values in an SQLite table
helper = new TaskDBHelper(Overview.this);
SQLiteDatabase sqlDB = helper.getReadableDatabase();
Cursor cursor = sqlDB.query(TaskContract.TABLE,
new String[]{TaskContract.Columns._ID, TaskContract.Columns.TASK, TaskContract.Columns.BAL, TaskContract.Columns.IP, TaskContract.Columns.STATUS},
null, null, null, null, null);
listAdapter = new SimpleCursorAdapter(
this,
R.layout.sum_view,
cursor,
new String[]{TaskContract.Columns.TASK, TaskContract.Columns.BAL, TaskContract.Columns.IP, TaskContract.Columns.STATUS},
new int[]{R.id.taskTextView, R.id.txtData, R.id.txtIP, R.id.txtStatus},
0
);
this.setListAdapter(listAdapter);
I am trying to set an image based on the value of one of the fields. The status column will return 1, 2 or 3 and I have 3 images that correspond, to display. Can anyone help me and explain how I can fit this into what I am already doing please?
helper = new TaskDBHelper(Overview.this);
SQLiteDatabase sqlDB = helper.getReadableDatabase();
Cursor cursor = sqlDB.query(TaskContract.TABLE,
new String[]{TaskContract.Columns._ID, TaskContract.Columns.TASK, TaskContract.Columns.BAL, TaskContract.Columns.IP, TaskContract.Columns.STATUS},
null, null, null, null, null);
listAdapter = new SimpleCursorAdapter(
this,
R.layout.sum_view,
cursor,
new String[]{TaskContract.Columns.TASK, TaskContract.Columns.BAL, TaskContract.Columns.IP, TaskContract.Columns.STATUS},
new int[]{R.id.taskTextView, R.id.txtData, R.id.txtIP, R.id.txtStatus},
0
);
this.setListAdapter(listAdapter);
I am trying to set an image based on the value of one of the fields. The status column will return 1, 2 or 3 and I have 3 images that correspond, to display. Can anyone help me and explain how I can fit this into what I am already doing please?