Anyone know how to implement an adapter that receives data from a content resolver created with dbflow?
I have database, provider and model class created but how interact with adapter? Is RecyclerView Adapter the best option for my needs? I have seen I something about ModelViewAdapter from dbflow but I still trying to understand how to implement using it.
You need a constructor in the adapter that receive your model class. for example:
public BeneficiaryListAdapter(Context context, List<Beneficiary> beneficiaryList){
mContext = context;
mBeneficiaryList = new ArrayList<>(beneficiaryList.size());
}
In my activity I receive a list of beneficiaries so, when that happens the next is to do the intance of the BeneficiaryListAdapter
and I pass the context and the the list List<Beneficiary> beneficiaryList
(in this case Beneficiary
is my model class).
mAdapter = new BeneficiaryListAdapter(getApplicationContext(), beneficiaryList);
Also, In my adapter, I have two class variables one that they will contain the context
and other for the list that I am going to receive in the constructor.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.