Saturday, 10 August 2013

List error: App crushes, No idea why

List error: App crushes, No idea why

I've built some class named "item", here is it: (thats the whole code)
public class item {
private int id;
private String title;
private String desc;
private double lat;
private double lon;
private String pub;
private int p;
private int n;
public item(int id, String title, String desc, double lat, double lon,
String pub, int p, int n) {
super();
this.id = id;
this.title = title;
this.desc = desc;
this.lat = lat;
this.lon = lon;
this.pub = pub;
this.p = p;
this.n = n;
}
Now I have to make a List<item> and add() "item"s to it, but for some
reason my application crushes.
Thats the Activity:
public class MainActivity extends Activity {
List<item> markers;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
item a = new item(1, "lol", "sdfs", 32.45345, 34.54353, "nir", 0, 0);
markers.add(a);
}
Appreciate your help guys!

No comments:

Post a Comment