Android获取文件夹路径 /data/data/

http://www.2cto.com/kf/201301/186614.html


String printTxtPath = getApplicationContext().getPackageResourcePath() + "/files/" + fileName;
=>/data/app/com.example.fileoperation-2.apk/files/printMenu.txt

String printTxtPath = getApplicationContext().getFilesDir();
String printTxtPath = getApplicationContext().getFilesDir().getAbsolutePath();
=> /data/data/com.example.fileoperation/files


//获取当前程序路径

getApplicationContext().getFilesDir().getAbsolutePath();

//获取该程序的安装包路径

String path=getApplicationContext().getPackageResourcePath();

//获取程序默认数据库路径

getApplicationContext().getDatabasePath(s).getAbsolutePath();

更多相关文章

  1. Android(安卓)6.0权限动态获取
  2. android 获取 imei号码
  3. Android处理POST请求、Android用SAX解析XML
  4. android系统信息总结
  5. Android下为自己定义WifiManager类wifi模块代码
  6. Ubuntu安装Android(安卓)Studio
  7. 工作记录[续] android OBB
  8. Android: TextView with border 带边框的TextView
  9. Android问题总结

随机推荐

  1. Android ORM 框架:GreenDao 使用详解(基础
  2. Android随VierPager滑动的导航栏
  3. Android(安卓)记事本-Demo
  4. android:ems 属性
  5. android 吸顶效果+下拉刷新 CoordinatorL
  6. Android自动测试框架Espresso
  7. 【Android 开发】:Android中EditText控件
  8. Android自学笔记之 Activity详解
  9. Android(安卓)drawText获取text宽度的三
  10. gradle for android 自动找当前环境当前