java - How to get SD card size programmatically in _EMULATOR_ in Android Studio -


this works on real gadget connected via usb cord while in debugging mode:

    statfs stat = new statfs(environment.getexternalstoragedirectory().getpath());     long bytestotal = (long) stat.getblocksize() * (long) stat.getblockcount();     long bytesavail = (long) stat.getblocksize() * (long) stat.getavailableblocks(); 

if, however, try run avd, 0 bytes. tools | android | avd manager | virtual devices | view details gave me this:

  1. name: nexus_5_api_21_x86
  2. cpu/abi: google apis intel atom (x86)
  3. path: c:\users\owner.android\avd\nexus_5_api_21_x86.avd
  4. target: google apis (api level 21)
  5. skin: nexus_5
  6. sd card: 200m
  7. snapshot: no
  8. hw.dpad: no
  9. runtime.network.speed: full
  10. hw.accelerometer: yes
  11. hw.device.name: nexus 5
  12. vm.heapsize: 64
  13. skin.dynamic: no
  14. hw.device.manufacturer: google
  15. hw.gps: yes
  16. hw.audioinput: yes
  17. tag.id: google_apis
  18. hw.camera.back: emulated
  19. hw.mainkeys: no
  20. avdid: nexus_5_api_21_x86
  21. hw.camera.front: emulated
  22. hw.lcd.density: 480
  23. runtime.scalefactor: auto
  24. avd.ini.displayname: nexus 5 api 21 x86
  25. snapshot.present: no
  26. hw.device.hash2: md5:2fa0e16c8cceb7d385183284107c0c88
  27. hw.ramsize: 1536
  28. hw.trackball: no
  29. hw.battery: yes
  30. hw.sdcard: no
  31. tag.display: google apis
  32. runtime.network.latency: none
  33. hw.keyboard: no
  34. hw.sensors.proximity: yes
  35. disk.datapartition.size: 200m
  36. hw.sensors.orientation: yes
  37. avd.ini.encoding: utf-8
  38. hw.gpu.enabled: yes

line 6 says i've got 200mb sd card; line 30 looks rather suspicious, though. relate haxm virtualization, chance? , big question: how sd card/external storage size @ run-time? i'd appreciate suggestion 'cause i'm sort of @ loss right now... :\


edit: alright, i'll answering own question. issue resolved after re-building avd scratch. have mbs. funny. must glitch or smth... , no, there's no relation haxm whatsoever. undestood after watching lynda.com video tutorial david gassner (he used haxm, too, , had no problems.)


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -