- File parentFile;
- File[] childFile;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- TextView textview=(TextView)findViewById(R.id.uri);
- String rooturi = Environment.getExternalStorageDirectory() + "/image";
- File root = new File(rooturi);
- if (root.exists()) {
- parentFile = root;
- childFile = root.listFiles();
- }
- textview.setText(childFile.length);
- }
- 最后一行总是出现错误
复制代码
|
|