要从listview打开文件,我有以下代码:
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
Option o = adapter.getItem(position);
if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){
currentDir = new File(o.getPath());
fill(currentDir);
}
else
{
onFileClick(o);
}
并且onfileClick(o)打开文件,但是当我想用LongClick删除文件时我不能,因为没有任何反应,我无法进入onLongListItemClick方法,我尝试了这样的一些:
protected boolean onLongListItemClick(View v, int pos, long id) {
Option o = adapter.getItem(position);
if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){
currentDir = new File(o.getPath());
fill(currentDir);
}
else
{
deleteFile(o);
}
}
但它不起作用,有人知道会发生什么?可以帮我?