Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8234723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:34:50+00:00 2026-06-07T18:34:50+00:00

Access USB Device Memory through programmatically. Get USB Device Total Memory Size. Get USB

  • 0

Access USB Device Memory through programmatically.

  1. Get USB Device Total Memory Size.
  2. Get USB Device Total Free(Available) Memory Size.

I know the memory size of Internal/External Memory

File path = Environment.getDataDirectory();
StatFs stat = new StatFs(path.getPath());
long blockSize = stat.getBlockSize();
long availableBlocks = stat.getAvailableBlocks();
String availableMemory =  Formatter.formatFileSize(this, availableBlocks * blockSize);
Log.i("","Available MB : " + availableMemory);

In this code does not worked for identifying the USB Device Memory.

How do find the USB Device Memory.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:34:52+00:00Added an answer on June 7, 2026 at 6:34 pm

    Hi Please use below code…

         StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getAbsolutePath());        
         long blockSize = statFs.getBlockSize();
         long totalSize = statFs.getBlockCount()*blockSize;
         long availableSize = statFs.getAvailableBlocks()*blockSize;
         long freeSize = statFs.getFreeBlocks()*blockSize;
    

    And If you fine in MB then

    long megAvailable = availableSize/ (1024 * 1024);
    Log.e("","Available MB : "+megAvailable);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want through the code to access specific folder in the USB device that
does anybody know of a secure 'read-once' local file access system? Or how one
I'm trying to access a USB Storage device, however the device although appearing in
I am writing a mini-filter code for USB (Flash Drives) for blocking i.e (Access
Which access modifiers which when used with the method makes it available to all
Using Access 2003 I want to get a table value from the two databases
Some software I am developing requires the presence of a USB device (which I
We have made a device which can act as an USB host or slave
Can a flash application (SWF) access the serial data on a USB port?
I'm implementing a class that talks to a motor controller over a USB device.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.