开发者

Create folder during application installation in android

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜