Well, you close your cursor and then try to return it ... it wonβt work so well. Either close the cursor and do not return anything, or return the cursor.
You also repeat the first first entries when you do movetofirst, movetonext, then movetofirst again.
I also believe that your getString needs a little help.
Here's how I say it:
titleTxt.setText(eventedit.getString(eventedit .getColumnIndexOrThrow(AttendanceDB.EVENT_NAME)));
titleTxt is the TextView link I installed earlier.
eventEdit is the cursor I want to get from (and created earlier)
AttendanceDB is my DB adapter class
EVENT_NAME is the column name variable that I set in the DB adapter class
EDIT
OK, now that I am re-reading your question, I understand that I am answering the wrong part. The problem is that your request is corrupted. I think it should be something like this:
Cursor cursorData = myDataBase.query(CSSTPipeSizingActivity.DB_TABLE, null, COLUMN_ID + "=" + CSSTPipeSizingActivity.spinnerPipeLengthText, null, null, null, null, null);
You need to indicate in which column the information you want is located (CSSTPipeSizingActivity.spinnerPipeLengthText). So replace COLUMN_ID with your column name or variable for it, and you should be good to go.
You really should get acquainted with the information here , especially with the various query method and their required parameters.
source share