I am using this class from my main activity:
public class MediaInfo {
public String name;
public String label;
// ... (other String and int fields)
public MediaSession mSession;
}
within an ArrayList:
public class MainActivity extends ActionBarActivity implements AsyncResponse {
private static final String TAG = "MainActivity";
ArrayList<MediaInfo> myMediaList;
private Context mContext;
public void onCreate(Bundle savedInstanceState) {
// ...
}
// ...
}
The problem I have is that MediaSession is a class that belongs to Android API version 21, and I am trying to make an app from version 14 on.
I would like the activity (or the class) to ignore the field containing the MediaSession class when the version is < 21. The first idea I have come across is using an abstract class and extend it when the version is >= 21, but then I would have to declare different ArrayLists, and I am not sure how I could do it. And maybe this is not the best way...
Any ideas...?
Thank you for your advice