I have a string array :
private String [] arrFilePaths=new String[4];
and I have a funtion which returns strings and im adding that to array:
@Override
public void accept(List<File> files) throws Exception {
int size = files.size();
while (size-- > 0) {
arrFilePaths[size]=files.get(size).toString();
}
}
Now i have a button and I am accessing array inside of it:
@Override
public void onClick(View v) {
if(arrFilePaths[0]==null){
//some code
}else {
//some code
}
Now the problem is arrFilePaths only return strings in button click sometime. most of time its returning null.The data always getting inserted to array before button click. so i dont know whats going on.
Yes i have tested in debug mode and arrFilePathsis getting data inserted, but somehow after the button click it saying null(even though I am using same variable).
Can anyone explain about this weird output? Thanks!