I have my application's package (com.my.package) and i'd like to be able to copy some files (a.txt, b.txt and c.txt) to another package (data/data/com.another.package/files). Now i've tried a few things i found, but none worked. Any help please?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You need to get the Runtime and use the cat
command.
Runtime.getRuntime().exec("su cat filepath1 > filepath2");
回答2:
Runtime.getRuntime().exec("su cat filepath1 > filepath2");
creates an empty file for me too. I have to use su -c
instead
Runtime.getRuntime().exec("su -c cat filepath1 > filepath2");