android创建不带_app前缀的内部存储文件夹 [英] android create internal storage folder without _app prefix
本文介绍了android创建不带_app前缀的内部存储文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码在内部存储器上成功创建文件夹,但是添加了前缀"_app"!因此,如果我创建"aplications"文件夹,它将被命名为"app_aplications".如何关闭它并设置所需的名称?谢谢
I am using following code to successfuly create folders on internal memory, but adds a prefix "_app"! So if I create "aplications" folder, it will be named as "app_aplications". How to dismiss it and set desired name? Thank you
public class DirectoriesActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
createFolder(getBaseContext());
}
public static void createFolder(Context context){
context.getDir("aplications", Context.MODE_PRIVATE); //Creating an internal dir;
}
}
推荐答案
您可以使用Java API代替Android API:
You can use Java API instead of Android API:
try{
boolean success = new File("data/data/com.sample/aplications").mkdir();
if (success)
// directory created
}catch (Expception e)
...
这篇关于android创建不带_app前缀的内部存储文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文