Code structure
public interface ListItem
public abstract class Device implements ListItem
public class DeviceList extends ArrayList<Device>
public class ListAdapter extends BaseAdapter{
...
public ArrayList<ListItem> items;
...
}
I want to pass DeviceList to ListAdapter, but can't cast DeviceList to ArrayList< ListItem>. Why is that?
If Device implements ListItem, and DeviceList is an array list of Device, shouldn't I be able to cast it?
I try it like this:
ArrayList<ListItem> list2 = (ArrayList<ListItem>) device_list;