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();
温馨提示:答案为网友推荐,仅供参考