Code example for CursorAdapter

Methods: notifyDataSetChanged

0
 
	public void setSelectedPosition(int position, ListView l) {
		if (mSelectedPosition != position) {
			//View view = (View) l.getItemAtPosition(position); 
			Log.e(TAG, String.format("Current position: %d. New position: %d", mSelectedPosition, position));
			notifyDataSetChanged();
			mSelectedPosition = position;
			 
		} 
		 
	} 
	 
 
	@Override 
	public void bindView(View view, Context context, Cursor cursor) {
		TextView list_item = (TextView)view.findViewById(android.R.id.text1);
		list_item.setText( /*cursor.getString(cursor.getColumnIndex(WB_INDICATOR_ID))+ "-" + */cursor.getString(cursor.getColumnIndex(INDICATOR_NAME)));
		int position = cursor.getPosition();
		if (mSelectedPosition == position) {
			view.setBackgroundColor(Color.parseColor("#8AC7E3"));
Connect your IDE to all the code out there  Get Codota for Java