Determine SD card status in Android

Source: Internet
Author: User

1String status =environment.getexternalstoragestate ();2 if(Status.equalsignorecase (environment.media_mounted)) {3Toast.maketext (Techolite. This, "SD card exists", Toast.length_long). Show ();4     //the SD is readable and writable at this time5}Else if(Status.equalsignorecase (environment.media_mounted_read_only)) {6Toast.maketext (Techolite. This, "Although SD exists, but is read-only State", Toast.length_long). Show ();7}Else if(Status.equalsignorecase (environment.media_removed)) {8Toast.maketext (Techolite. This, "SD does not exist", Toast.length_long). Show ();9}Else if(Status.equalsignorecase (environment.media_shared)) {TenToast.maketext (Techolite. This, "Although SD card exists, but it is connected with PC etc.", Toast.length_long). Show (); One}Else if(Status.equalsignorecase (environment.media_bad_removal)) { AToast.maketext (Techolite. This, "SD card is mistakenly removed in Mount State", Toast.length_long). Show (); -}Else if(Status.equalsignorecase (environment.media_checking)) { -Toast.maketext (Techolite. This, "Checking SD card", Toast.length_long). Show (); the}Else if(Status.equalsignorecase (environment.media_nofs)) { -Toast.maketext (Techolite. This, "Although the SD card exists but its file system is not supported", Toast.length_long). Show (); -}Else if(Status.equalsignorecase (environment.media_unmountable)) { -Toast.maketext (Techolite. This, "Although the SD card is present but cannot be mounted", Toast.length_long). Show (); +}Else if(Status.equalsignorecase (environment.media_unmounted)) { -Toast.maketext (Techolite. This, "Although the SD card is present but not mounted", Toast.length_long). Show (); +}Else { AToast.maketext (Techolite. This, "other reasons", Toast.length_long). Show (); at}

Determine SD card status in Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.