I am trying to get a value from the first line of a csv file ( header excluded) store in Firebase Storage
Here is the code :
private String readFromCsv() {
    StorageReference refCompteActifs = FirebaseStorage.getInstance().getReference().child("my_file").child("my_file.csv");
    StorageReference gsReference = refCompteActifs.getStorage().getReferenceFromUrl("gs://test-8095e.appspot.com/my_file/my_filer.csv");
    File localFile = null;
    try {
        localFile = File.createTempFile("my_file", ".csv");
    } catch (IOException e) {
        e.printStackTrace();
    }
    File finalLocalFile = localFile;
    final String[] result = {null};
    List<String> rows = new ArrayList<>();
    gsReference.getFile(Objects.requireNonNull(localFile)).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
        @Override
        public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
            try {
                CSVReader reader = new CSVReader(new FileReader("./data/user/0/com.example.test/cache/" + finalLocalFile.getName()), ',', '\'', 1);
                String[] nextLine = null;
                while ((nextLine = reader.readNext()) != null) {
                    System.out.println(nextLine[4] + "\n");
                    rows.add(nextLine[4]);
                    
                }
              
            } catch (IOException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < rows.size(); i++) {
                result[0] = rows.get(i);
            }
        }
    }
    System.out.println(result[0] + "\n");
    return result[0];
}
The console never write "System.out.println(result[0] + "\n");" result[0] is affected inside the onlistener but I can't access it outside of it.
Thank you for your Help
 
    