public String[] get_file_names_from_SD() /* Compiler complains here */
{
String state = Environment.getExternalStorageState();
if (state.equals(Environment.MEDIA_MOUNTED)) {
File root = Environment.getExternalStorageDirectory();
File dir = new File(root.getAbsolutePath() + "/journal_storage");
if (dir.exists() & dir.isDirectory()) {
return (dir.list());
}
} else {
Toast.makeText(getActivity(), "Media Mounted Issue", Toast.LENGTH_SHORT).show();
}
}
So I am returning dir.list() which will contain an array of strings but for some reason compiler is showing an error "This method must return a result of type String[]".
According to the Android documentation, the method returns an array of Strings.
Can anyone can tell me what I am doing wrong?
&, there should be&&in condition.. :)