There is a database with columns (for example) id | st1 | St2, write to St2, for example, the number 4, then we get the record 1 | null | 4. There is a TextView in the activity in which the last value of the column st1 is written by code, during the start of the activity we refer to the database and make a request only for st1, but the cursor accesses the null value and crashes the execution, how to perform the check? if there were no records, it is checked simply through
if (cursor.moveToFirst) { textview.setText(получаем текст из БД); } else { textview.setText("рандом текст"); } but how to be when in this desired cell null can not understand
cursor.moveToFirstreturnstrueorfalseand cannot returnnullin any way. The result of this method also indicates whether the cursor was able to move to the first record in the result or not. By the values in the columns, this method has nothing to do. - temq Nov.