I got these two classes. The one below should get an ArrayList with movies...
import java.util.ArrayList ;
import android.app.Activity ;
import android.os.Bundle ;
public class UIDActivity extends Activity {
private static ArrayList<Movie> movieList;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public static void main(String String, int
int args[]
) {
movieList = new ArrayList<Movie>();
movie1 = new Movie("Fight Club", "David Fincher", "1999", "3");
movieList.add(movie1);
}
public String getTitle() {
return title;
}
public String getDirector() {
return director;
}
public int getYear() {
return year;
}
public int getRating() {
return rating;
}
}
this is the Movie class, in which I tell what the attributes are of a Movie
import java.io.Serializable ;
@SuppressWarnings("serial")
public class Movie implements Serializable {
public String title;
public String director;
public int year;
public int rating;
public Movie(String deTitle, String deDirector, int hetYear, int deRating) {
title = deTitle;
director = deDirector;
year = hetYear;
rating = deRating;
}
public void setTitle(String title) {
this.title = title;
}
public void setDirector(String director) {
this.director = director;
}
public void setYear(int year) {
this.year = year;
}
public void setRating(int rating) {
this.rating = rating;
}
}
For some reason I can't figure out what simple thing I keep forgetting?!?! Eclipse wants to change my public Movie to four times String... No errors there, but rest won't work neither.
public static void main(String String, int int args[])
, is that a typo (the 2 int + the weird signature with additional int args[] parameter)? AndString String
? That code would not compile. Can you post the actual code. – assylias Jul 5 at 17:54