I’m using a script from a ListView tutorial and am trying to get some random stuff done, main purpose learning Android SDK. I can’t get through one thing…
Piece of the script:
private static class Video { public String title;
public String description;
public int image;
.
.
.
public Video(String title, String description, int image) {
this.title = title;
this.description = description;
this.image = image;
}
}
private static final Object[] OBJECTS = {
"Movies",
new Video("Iron Man 2", "description", R.drawable.ferrari),
new Video("Twilight - Chapitre 3 : hasitation"),
"Series",
.
.
.
};
I know if i use OBJECTS[0].toString() i get “Movies”. But how the heck do i get the first value (title) from the ‘new Video()’ entry at a current position.
I think this should do:
Btw encapsulate your data. Usually it’s not a good idea to have the class attributes as
public. Write getters and setters.