I have constructed a class to mimic a C# struct:
public class Favourite {
protected String favName;
protected String favText;
protected String favDelay;
protected GeoPoint favPoint;
protected Uri favUri;
}
I want to create an array of this class:
Favourite[] fav;
When I try to access this array:
fav[s].favName = bufr;
I get a NullPointerException. bufr does contain data. I have tracked it down to accessing the array as the following code:
fav[s].favName = "";
also produces a NullPointerException.
I have searched high and low for some indication as to whether or not what I am doing is allowed but cannot find anything.
I suppose my questions are:
Are you allowed to create an array of a class object? If so, how do you refer to that array?
I know I could do this using five separate arrays of the variables but I feel that putting them into a class gives a better structure and is more elegant (I like elegance).