开发者

Create folder during application installation in android

开发者 https://www.devze.com 2023-02-26 11:14 出处:网络
Can we create a directory on the internal storageof the device during application installation .Also after creating thati need to copy some images and music to that directory from our res folder. Does

Can we create a directory on the internal storage of the device during application installation .Also after creating that i need to copy some images and music to that directory from our res folder. Does anyone have any ideas as to cre开发者_StackOverflowate a directory at install time? Thanks in advance


  public void onCreate(Bundle savedInstanceState) {

       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);

       // creating Derectory on SD card
       File nfile=new File(Environment.getExternalStorageDirectory()+"/directory name");
       nfile.mkdir();
     }


You can make the directory in an ACTION_PACKAGE_ADDED Broadcast Receiver, but it must be caught on other package than your installed app.

0

精彩评论

暂无评论...
验证码 换一张
取 消