How can I highlight a row in a ListView backed by a CursorAdapter knowing the row ID of the item?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If by “highlight” you mean “select”, you will need to manually iterate over your
Cursor, find which position corresponds to that_idvalue, then callsetSelection()on theListViewto select the row with that position. This will only have an impact if the user is not in touch mode, as there is no concept of a selection in aListViewif the user is using the touch screen.EDIT
Given your first comment, you will need to do several things:
getViewTypeCount()to return2, since you have two types of rows (normal and special)getItemViewType()to return0or1, depending on whether the position is the one for your desired_idor notbindView()and based on the item view type, inflate and tailor the row as needed