I am making a file explorer in android. So I want when any file is clicked other than directory I want to get a suggestion of apps which can open it and if no app is there then show a dailog. I tried some solutions but nothing worked, so, for now, I am just showing the file is not a directory in the toast
here is part of the code:
protected void onListItemClick(ListView l, View v, int position, long id) {
String filename = (String) getListAdapter().getItem(position);
if (path.endsWith(File.separator)) {
filename = path + filename;
} else {
filename = path + File.separator + filename;
}
if (new File(filename).isDirectory()) {
Intent intent = new Intent(this, ListFileActivity.class);
intent.putExtra("path", filename);
startActivity(intent);
} else {
Toast.makeText(this, filename + " is not a directory", Toast.LENGTH_LONG).show();
}
}