public class GlobalVariable extends Application {
private static String[] array;
public static void setarray(String[] array) {
GlobalVariable.array = Arrays.copyOf(array, array.length);
}
public static String[] getArray() {
return Arrays.copyOf(array, array.length);
}
}
i have use it like this
String []array = new String[list.size()];
for(int i1 = 0; i1 < list.size(); i1++)
{
array[i1] = list.get(i1);
System.out.println("this is from array"+array[i1]);// this statment running proper.. displays in my logcate
}
GlobalVariable.setarray(array);
}
now i want this value in another activity that extends Frgment
i have use it like:
String[] array1 = new String[1000];
array1 = GlobalVariable.getArray();
for(int i=0;i<array1.length;i++)
{
System.out.println(array1[i]);
}
But it crashes my application by saying null pointer exception how to use it?