I'm working on a program which needs to show list file in ListView. I got this list with path_of_files. But this is what i want to ask: when i clicked on an item, how can user open it? I think i want a popup let user choose which program user want to open it. For example: I have a path: /sdcard/file.xls. When user clicked in, a popup shows some application like: Microsoft Excel, Google Spreadsheet (I only want to work with xls - and it only works with it, still ok). How can i do it?
File sdCardRoot = Environment.getExternalStorageDirectory();
File yourDir = new File(sdCardRoot, "directory");
for (File f : yourDir.listFiles()) {
if (f.isFile()) {
String name = f.getName();
Long lastModified = f.lastModified();
if (name.toLowerCase().contains(".xls"))
fileObjList.add(new FileObj(0,name,lastModified));
}
}
This is my code to get filename and file path.