@Override public void onListItemClick(ListView l, View v, int position, long id) { File file = mAdapter.getItem(position); if (file.isDirectory()) { openDirectory(file); } else { getMediaServer().status().command.input.play(file.getMrl(), file.getOptions()); } }
private boolean isDirectory(ContextMenuInfo menuInfo) { if (menuInfo instanceof AdapterContextMenuInfo) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; if (info.position < mAdapter.getCount()) { File file = mAdapter.getItem(info.position); return file.isDirectory(); } } return false; }