Java 如何从sqLite获取值
我有一个RecyclerView,在适配器中,我需要从我的sqLite数据库中获取一个值。更确切地说:Java 如何从sqLite获取值,java,android,sqlite,android-adapter,android-recyclerview,Java,Android,Sqlite,Android Adapter,Android Recyclerview,我有一个RecyclerView,在适配器中,我需要从我的sqLite数据库中获取一个值。更确切地说: @Override public void onBindViewHolder(SimpleViewHolder holder, int position) { shOperations = new ShortcutsOperations(DrawerActivity.instance); shOperations.open(); Lis
@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;
}
“名字”是我需要的。我的数据库只有两列,一列名为ID,另一列名为NAME。如何从适配器中的数据库中检索正确的值以在
ImageView
中正确设置图像?如果问题只是关于“如何从SQLite数据库获取数据”,那么我认为您可以使用SQLite助手类查询SQLite数据库以获取适配器中所需的数据
希望这就是您想要的。您的SQLite上有这个
名称吗?