Hello! I populate the listView from the SQLite database as follows:
SQLiteDatabase database = dbHelper.getReadableDatabase(); Cursor cursor = database.query(DBHelper.TABLE_ONE, null, null, null, null, null, null); String[] from = new String[]{DBHelper.COLUMN_ONE, DBHelper.COLUMN_TWO}; int[] to = new int[]{R.id.textView1, R.id.textView2}; SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(this, R.layout.list_item, cursor, from, to, 0); listView.setAdapter(cursorAdapter); Got a question. Suppose I have a column COLUMN_ONE, in which there may be some text, or "Absent". So, how to make sure that if in COLUMN_ONE is "Missing", then in R.id.textView1 nothing is displayed (""), and not "Missing"?
Question number two. COLUMN_TWO type integer. On R.layout.list_item, besides textView1 there is an imageView. How to digitally display a picture in the list item? For example, if the digit is 0, then the picture will be one, if 1, then the other, etc.
bindView()adapter, check for the contents of the string and if = "absent" in TextView, find an empty string. For the second, store not abstract numbers, but the ID of the image you want to display, then by this ID, put a picture in the widget. You will not have the condition, because there are left numbers in the database, and the comparison is with the ID of the picture - pavlofff