Запись данных из ListView в текстовый файл

Я пишу приложение BluetoothScanner и в методе, который приведен ниже, в ListView приходят данные об имени телефона, его Mac-адрес, дата обнаружения и уровень сигнала. Как эти данные можно записать в текстовый файл?

 private final BroadcastReceiver devicesFoundReceiver = new BroadcastReceiver() {
        @RequiresApi(api = Build.VERSION_CODES.O)
        @Override
        public void onReceive(Context context, Intent intent) {
                String action = intent.getAction();
                Date currentDate = new Date();
                DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
                DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault());
                String timeText = timeFormat.format(currentDate);
                String dateText = dateFormat.format(currentDate);
                int rssi = intent.getShortExtra(BluetoothDevice.EXTRA_RSSI, Short.MIN_VALUE);
                if (BluetoothDevice.ACTION_FOUND.equals(action)) {
                    BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                    listAdapter.add(device.getName() + "\n" + device.getAddress() + "\n" + dateText + " " + timeText + " " + rssi + "dBm");
                    listAdapter.notifyDataSetChanged();
                } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
                    scanningBtn.setText("Scan Bluetooth Devices");
                } else if (BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(action)) {
                    scanningBtn.setText("Scanning in progress...");
                }
            }
    };

Ответы (1 шт):

Автор решения: Антоша

Проще всего в настройки

http://developer.alexanderklimov.ru/android/preferences_framework.php

Если в отдельный файл, то через стандартные средства Java, типа nio.File

→ Ссылка