I've got a RecyclerView and in the adapter I need to get a value from my sqLite database. More exactly here:
@Override
public void onBindViewHolder(SimpleViewHolder holder, int position) {
shOperations = new ShortcutsOperations(DrawerActivity.instance);
shOperations.open();
List values = shOperations.getAllShortcuts();
try {
icon = DrawerActivity.instance.getPackageManager().getApplicationIcon(name.get(position));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
holder.title.setImageDrawable(icon);
final View itemView = holder.itemView;
}
"name" it's which I need. My database has only 2 columns, One called ID and the other called NAME. How can I retrieve the correct value from the database in the adapter to set correctly my image in the ImageView
?
Aucun commentaire:
Enregistrer un commentaire