Skip to content

Instantly share code, notes, and snippets.

@tatd3v
Created May 1, 2020 03:59
Show Gist options
  • Save tatd3v/2223c53b019cdeddba33d8c98aca603a to your computer and use it in GitHub Desktop.
Save tatd3v/2223c53b019cdeddba33d8c98aca603a to your computer and use it in GitHub Desktop.
package com.edu.uac.co.grupo6_act4;
import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CursorAdapter;
import android.widget.TextView;
public class PatientCursorAdapter extends CursorAdapter {
int selectedPosition = -1;
public PatientCursorAdapter(Context context, Cursor c, int flags) {
super(context, c, flags);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
return LayoutInflater.from(context).inflate(R.layout.patient_data, parent, false);
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
CheckBox selectionCV = (CheckBox) view.findViewById(R.id.selectCheckBox);
TextView txtVIds = (TextView) view.findViewById(R.id.idTextV);
TextView txtVNames = (TextView) view.findViewById(R.id.nameTxtV);
TextView txtVAddresses = (TextView) view.findViewById(R.id.addressTxtV);
TextView txtVAttentPlaces = (TextView) view.findViewById(R.id.attenPlaceTxtV);
TextView txtVPositiveDates = (TextView) view.findViewById(R.id.positiveDateTxtV);
String id = cursor.getString(cursor.getColumnIndexOrThrow("_id"));
String name = cursor.getString(cursor.getColumnIndexOrThrow("NAME"));
String address = cursor.getString(cursor.getColumnIndexOrThrow("ADDRESS"));
String attentionPlace = cursor.getString(cursor.getColumnIndexOrThrow("ATTENTION_PLACE"));
String positiveDate = cursor.getString(cursor.getColumnIndexOrThrow("POSITIVE_TEST_DATE"));
txtVIds.setText(id);
txtVNames.setText(name);
txtVAddresses.setText(address);
txtVAttentPlaces.setText(attentionPlace);
txtVPositiveDates.setText(positiveDate);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment