列名不明确:使用Room Presistent Library在AndroidStudio中输入

时间:2019-07-08 01:13:02

标签: java android-studio

我只是试图根据我之前选择的信息来使列表显示一些信息

我有

对象1摘要

和扩展对象1的对象a,b,c,d,e

listview 1显示对象a,b,c,d,e

和列表视图2显示许多对象,具体取决于您在列表视图1中单击的项目。

我的问题是列表视图2中的所有那些对象必须是对象1类型的List <>

@Entity
    public static final int TYPE_COFFEE = 0;
    public static final int TYPE_MARKET = 1;
    public static final int TYPE_POST = 2;
    public static final int TYPE_RESTAURANT = 3;
    public static final int TYPE_STORE = 4;

    @PrimaryKey(autoGenerate = true)
    private long id;
    private String image;
    private String establishmentName;
    private String adress;
    public int type;

    public Establishment(long id, String image, String establishmentName, String adress) {
        this.id = id;
        this.image = image;
        this.establishmentName = establishmentName;
        this.adress = adress;
    }
@Dao

    @Query("SELECT * FROM Coffee, Market, Post, Restaurant, Store WHERE type = :type")
    List<Establishment> getEstablishmentByType(int type);
@Place where I want to use that info

        List<Establishment> establishmentList = EstablishmentDB.getInstance(this).getEstablishmentDao().getEstablishmentByType(establishmentType);
        EstablishmentListAdapter adapter = new EstablishmentListAdapter(establishmentList, this);
        establishmentListView.setAdapter(adapter);

0 个答案:

没有答案