Android 在SD卡上建立文件夹

来源:互联网 发布:we淘宝官方旗舰店 编辑:程序博客网 时间:2024/06/06 03:23

代码如下:

[java] view plaincopy
  1. public class make extends Activity {   
  2.     /** Called when the activity is first created. */   
  3.     @Override   
  4.     public void onCreate(Bundle savedInstanceState) {   
  5.         super.onCreate(savedInstanceState);   
  6.         setContentView(R.layout.main);   
  7.         File sd=Environment.getExternalStorageDirectory();   
  8.         String path=sd.getPath()+"/notes";   
  9.         File file=new File(path);   
  10.         if(!file.exists())   
  11.          file.mkdir();          
  12.     }   
  13. }   
0 0
原创粉丝点击