I made a app for Mac/Windows. On these OSes, I can use JFileChooser to choose a file from my computer. But I'm going to make a mobile version of my app, for Android. Here's my code of mentioned function, that is for a desktop OS:
public static String readFile() {
JFileChooser fc;
File file;
fc = new JFileChooser(defaultPath);
if (fc.showOpenDialog(new JFrame()) == JFileChooser.APPROVE_OPTION) {
file = fc.getSelectedFile();
} else {
return null;
}
try {
Scanner reader = new Scanner(file);
content = reader.useDelimiter("\\A").next();
} catch (IOException e) {
System.exit(0);
}
return content;
}
My question is: How to make it work on Android?