C
C
Comatu2017-10-22 09:13:42
Android
Comatu, 2017-10-22 09:13:42

How to call method with ArrayList urls parameter?

Sorry for the elementarism, the question is: How to call a method with an ArrayList urls parameter?
Here is the method code:

void writeFile(ArrayList<String> urls) {
        try {
            // отрываем поток для записи
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
                    openFileOutput(FILENAME, MODE_PRIVATE)));
            // пишем данные
            bw.write(String.valueOf(initData(urls)));
            // закрываем поток
            bw.close();
            Log.d(LOG_TAG, "Файл записан");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

I write writeFile(ArrayList urls); but the studio emphasizes everything, offers two options:
1) create a new method without parameters
2) remove the parameter from the existing method (the code is shown above)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2017-10-22
@Comatu

ArrayList urls = new ArrayList<>();
writeFile(urls);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question