文件搜索出错,求助
public void ToSearchFiles(File file) { //定义一个File文件数组,用来存放 /sdcard 目录下的文件或文件夹 File[] the_Files = file.listFiles() ; //通过遍历所有文件和文件夹 for (File tempF : the_Files) { if (tempF.isDirectory()) ToSearchFiles(tempF); else { try { //是文件,进行比较,如果文件名称中包含输入搜索Key,则返回大于-1的值 if (tempF.getName().indexOf(theKey_formInput) > -1) { //获取符合条件文件的路径,进行累加 path +="\n"+ tempF.getPath(); //显示结果的TextView显示信息和搜索到的路径 show_Result.setText(info + path); } } catch (Exception e) { // TODO: handle exception //如果路径找不到,提示出错 Toast.makeText(this, getString(R.string.pathError),Toast.LENGTH_SHORT).show(); } } }