I was just trying to make a list display some information based on the information that I selected before
I have
object 1 abstract
and object a, b, c, d, e that extends object 1
listview 1 displays object a, b, c, d, e
and listview 2 displays many objects depending on what item you clicked on list view 1
my problem is that all those objects in listview 2 must be a List<> of type object 1
@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);