android下文件选择

时间:2017-10-02 02:54:44
【文件属性】:
文件名称:android下文件选择
文件大小:684KB
文件格式:RAR
更新时间:2017-10-02 02:54:44
打开 android 非常不错的文件搜索界面FileInfo fileInfo = (FileInfo)(((FileChooserAdapter)adapterView.getAdapter()).getItem(position)); if(fileInfo.isDirectory()) //点击项为文件夹, 显示该文件夹下所有文件 updateFileItems(fileInfo.getFilePath()) ; else if(fileInfo.isPPTFile()){ //是ppt文件 , 则将该路径通知给调用者 Intent intent = new Intent(); intent.putExtra(MainActivity.EXTRA_FILE_CHOOSER , fileInfo.getFilePath()); setResult(RESULT_OK , intent); finish(); } else { //其他文件..... toast(getText(R.string.open_file_error_format)); } } }; public boolean onKeyDown(int keyCode , KeyEvent event){ if(event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_BACK){ backProcess(); return true ; } return super.onKeyDown(keyCode, event); } //返回上一层目录的操作 public void backProcess(){ //判断当前路径是不是sdcard路径 , 如果不是,则返回到上一层。 if (!mLastFilePath.equals(mSdcardRootPath)) { File thisFile = new File(mLastFilePath); String parentFilePath = thisFile.getParent(); updateFileItems(parentFilePath); } else { //是sdcard路径 ,直接结束 setResult(RESULT_CANCELED); finish(); } } private void toast(CharSequence hint){ Toast.makeText(this, hint , Toast.LENGTH_SHORT).show(); } }
【文件预览】:
AndroidFileChooser
----.project(854B)
----project.properties(563B)
----src()
--------com()
----AndroidManifest.xml(1KB)
----res()
--------values-large()
--------drawable-ldpi()
--------values-zh-rCN()
--------drawable-hdpi()
--------menu()
--------drawable-mdpi()
--------layout()
--------drawable-xhdpi()
--------values()
----.settings()
--------org.eclipse.core.resources.prefs(57B)
----assets()
----gen()
--------com()
----libs()
--------android-support-v4.jar(265KB)
----.classpath(475B)
----proguard-project.txt(781B)
----bin()
--------resources.ap_(29KB)
--------classes()
--------AndroidManifest.xml(1KB)
--------AndroidFileChooser.apk(147KB)
--------dexedLibs()
--------jarlist.cache(120B)
--------res()
--------classes.dex(428KB)

网友评论

  • 值得参考,有价值
  • 参考价值不错,选择文件UI部分比较好
  • 很不错,值得学习!
  • 还不错的文件搜索界面,学习了