I wanted to store a value from a string array to another string array. But I get "NullPointerException" error with the code below. "imagesSelected" is a string array stored with values inside. But when i wanted to move it into another string array after substring, I get error. I believed is because of the last line of code. I'm not sure how to make it work.
String[] imageLocation;
if(imagesSelected.length >0){
for(int i=0;i<imagesSelected.length;i++){
int start = imagesSelected[i].indexOf("WB/");
imageLocation[i] = imagesSelected[i].substring(start + 3);
}
}
imageLocationarray to the right size.String[] imageLocation = new String[x];is it?