i get NullPointerException at the start of the for where am i going wrong?
public void checkzone(Location loc)
{
X = new List<float[]>() {
};
Y = new List<float[]>() {
};
X.clear();
Y.clear();
float x = (float) loc.getLatitude();
float y = (float) loc.getLongitude();
float A1X[] = {(float) 41.992853, (float) 41.994815, (float) 41.995158, (float) 41.993065};//DOMA
float A3X[] = {(float) 41.994594, (float) 41.994595, (float) 41.993744, (float) 41.993747};//OVIE SE TOCNI
float A4X[] = {(float) 41.121212, (float) 41.121212, (float) 41.121212, (float) 41.121212};
float A5X[] = {(float) 41.121212, (float) 41.121212, (float) 41.121212, (float) 41.121212};
float A6X[] = {(float) 41.121212, (float) 41.121212, (float) 41.121212, (float) 41.121212};
float B2X[] = {(float) 41.121212, (float) 41.121212, (float) 41.121212, (float) 41.121212};
float C11X[] ={(float) 41.121212, (float) 41.121212, (float) 41.121212, (float) 41.121212};
float C15X[] = {(float) 41.121212, (float) 41.121212, (float) 41.121212, (float) 41.121212};
float C17X[] = {(float) 41.121212, (float) 41.121212, (float) 41.121212, (float) 41.121212};
float A1Y[] = {(float) 21.411527, (float) 21.411505, (float) 21.4142847, (float) 21.415116};//Doma
float A3Y[] = {(float) 21.427817, (float) 21.428015, (float) 21.427972, (float) 21.427763};//OVIE SE TOCNI
float A4Y[] = {(float) 21.122112, (float) 21.122112, (float) 21.122112, (float) 21.122112};
float A5Y[] = {(float) 21.122112, (float) 21.122112, (float) 21.122112, (float) 21.122112};
float A6Y[] = {(float) 21.122112, (float) 21.122112, (float) 21.122112, (float) 21.122112};
float B2Y[] = {(float) 21.122112, (float) 21.122112, (float) 21.122112, (float) 21.122112};
float C11Y[] = {(float) 21.122112, (float) 21.122112, (float) 21.122112, (float) 21.122112};
float C15Y[] = {(float) 21.122112, (float) 21.122112, (float) 21.122112, (float) 21.122112};
float C17Y[] = {(float) 21.122112, (float) 21.122112, (float) 21.122112, (float) 21.122112};
X.add(A1X);
X.add(A3X);
X.add(A4X);
X.add(A5X);
X.add(A6X);
X.add(B2X);
X.add(C11X);
X.add(C15X);
X.add(C17X);
X.add(A1X);
Y.add(A1Y);
Y.add(A3Y);
Y.add(A4Y);
Y.add(A5Y);
Y.add(A6Y);
Y.add(B2Y);
Y.add(C11Y);
Y.add(C15Y);
Y.add(C17Y);
Y.add(A1Y);
for(int i=0; i<=X.size();i++)
{
if (pointInPolygon(X.get(i).length,X.get(i),Y.get(i),x,y))
{
switch (i) {
case 1:
zonefoundsettexts("A1");
case 2:
zonefoundsettexts("A3");
case 3:
zonefoundsettexts("A4");
case 4:
zonefoundsettexts("A5");
case 5:
zonefoundsettexts("A6");
case 6:
zonefoundsettexts("B2");
case 7:
zonefoundsettexts("C11");
case 8:
zonefoundsettexts("C15");
case 9:
zonefoundsettexts("C17");
}
}
// else
// zonefoundsettexts("nozone");
}
};