My app need to transfer some files from the bluetooth folder, to another folder created by my application. The problem is that the bluetooth folder is located at different paths on different devices. On my Samsung galaxy S3
the path is /mnt/sdcard/Bluetooth
and when I test the application on a Samsung galaxy S2
I can't even find the bluetooth folder! Is there anyway I can search for, or get the bluetooth folder programmatically in Java?
This is the code where I navigate me to the Bluetooth folder on my Samsung S3:
File sdCard = Environment.getExternalStorageDirectory();
String bluetoothFile = sdCard.getAbsolutePath() + "/Bluetooth";
File bluetoothFolder = new File(bluetoothFile);
And using this get
method to get the path to my bluetooth folder
public File getBluetoothFolder() {
return bluetoothFolder;
}
This is just for the Samsung S3, but when I upload the app to another phone, this will only result in a NullPointerException
because the bluetooth folder isn't located at /mnt/sdcard/Bluetooth