//items 存放显示的名称 paths存放文件路径 rootPath起始目录
private List<String> items = null;
private List<String> paths = null;
private String rootPath = "/";
private TextView mPath;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mPath = (TextView) findViewById(R.id.textView1);
getFileDir(rootPath);
}
private void getFileDir(String filePath) {
mPath.setText(filePath);
items = new ArrayList<String>();
paths = new ArrayList<String>();
File files = new File(filePath);
File [] f = files.listFiles();
if(!filePath.equals(rootPath)){
//第一个设置为回到根目录
items.add("back to"+rootPath);
paths.add(rootPath);