我从Json数据中将数据转储到SQLite中.现在我的问题是我有一个包含多个表的数据库我希望使用id来关联多个表.这些是我创建的3个表.
这是我们有产品清单的第一张表,
private static final String DATABASE_CREATE_PRODUCT =
"CREATE TABLE if not exists " + "product_template" + " (" +
"_id" + " integer PRIMARY KEY autoincrement," +
"name" + "," +
"list_price" + "," +
"create_date" + "," +
"default_code" + "," +
"ean13" + "," +
"image_new" + "," +
"image_variant" +
");";
Run Code Online (Sandbox Code Playgroud)
这是我们有合作伙伴名单的第二张表,
private static final String DATABASE_CREATE_PARTNER =
"CREATE TABLE if not exists " + "res_partner" + " (" +
"_id" + " integer PRIMARY KEY …Run Code Online (Sandbox Code Playgroud) 这是我的代码,每行显示 2 个项目。
extends Fragment {
private RecyclerView recyclerView;
private AlbumsAdapter adapter;
private List<Album> albumList;
protected View view;
private FloatingActionButton fab;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_ebooks, container, false);
fab = (FloatingActionButton) view.findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), ProductsActivity.class);
startActivity(intent);
}
});
initCollapsingToolbar();
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
albumList = new ArrayList<>();
adapter = new AlbumsAdapter(getActivity(), albumList);
RecyclerView.LayoutManager …Run Code Online (Sandbox Code Playgroud)