mercredi 23 octobre 2019

how can i show the values of checkbox from mysql server

i want it show that it checked , i have columan contain (1s and 0s) so i want 1 is checked and 0 is not but idk how to do that plz help @Override public void onBindViewHolder(MyViewHolder holder, int position) {

    holder.name.setText("Book Name:  " +contacts.get(position).getName());
    holder.email.setText("Book Stand number:  " + contacts.get(position).getEmail());
    holder.country.setText("Shelf number:  " + contacts.get(position).getCountry());
    holder.booknumber.setText("Book number:  " + contacts.get(position).getBooknum());
    holder.TechExists.setChecked(contacts.get(position).getTechnologyExists()==1);

}



@Override
public int getItemCount() {
    return contacts.size();
}

public static class MyViewHolder extends RecyclerView.ViewHolder{
    TextView name,email,country,booknumber ;
    CheckBox TechExists ;
    public MyViewHolder(View itemView) {
        super(itemView);
        name = itemView.findViewById(R.id.name);
        email = itemView.findViewById(R.id.email);
        country = itemView.findViewById(R.id.country);
        booknumber = itemView.findViewById(R.id.booknumber);
        TechExists = (CheckBox) itemView.findViewById(R.id.chkTechExists);
    }
}



Aucun commentaire:

Enregistrer un commentaire