Stay organized with collections
Save and categorize content based on your preferences.
MtpStorageInfo
class MtpStorageInfo
This class encapsulates information about a storage unit on an MTP device. This corresponds to the StorageInfo Dataset described in section 5.2.2 of the MTP specification.
Summary
Public methods |
String |
Returns the description string for the storage unit.
|
Long |
Returns the amount of free space in the storage unit in bytes
|
Long |
Returns the maximum storage capacity for the storage unit in bytes
|
Int |
Returns the storage ID for the storage unit.
|
String |
Returns the volume identifier for the storage unit
|
Public methods
getDescription
fun getDescription(): String
Returns the description string for the storage unit. This is typically displayed to the user in the user interface on the MTP host.
Return |
String |
the storage unit description This value cannot be null . |
getFreeSpace
fun getFreeSpace(): Long
Returns the amount of free space in the storage unit in bytes
Return |
Long |
the amount of free space |
getMaxCapacity
fun getMaxCapacity(): Long
Returns the maximum storage capacity for the storage unit in bytes
Return |
Long |
the maximum capacity |
getStorageId
fun getStorageId(): Int
Returns the storage ID for the storage unit. The storage ID uniquely identifies the storage unit on the MTP device.
Return |
Int |
the storage ID |
getVolumeIdentifier
fun getVolumeIdentifier(): String
Returns the volume identifier for the storage unit
Return |
String |
the storage volume identifier This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# MtpStorageInfo\n\nAdded in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nMtpStorageInfo\n==============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/mtp/MtpStorageInfo \"View this page in Java\") \n\n```\nclass MtpStorageInfo\n```\n\n|---|---------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.mtp.MtpStorageInfo](#) |\n\nThis class encapsulates information about a storage unit on an MTP device. This corresponds to the StorageInfo Dataset described in section 5.2.2 of the MTP specification.\n\nSummary\n-------\n\n| Public methods ||\n|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getDescription](#getDescription())`()` Returns the description string for the storage unit. |\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getFreeSpace](#getFreeSpace())`()` Returns the amount of free space in the storage unit in bytes |\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getMaxCapacity](#getMaxCapacity())`()` Returns the maximum storage capacity for the storage unit in bytes |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getStorageId](#getStorageId())`()` Returns the storage ID for the storage unit. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getVolumeIdentifier](#getVolumeIdentifier())`()` Returns the volume identifier for the storage unit |\n\nPublic methods\n--------------\n\n### getDescription\n\nAdded in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getDescription(): String\n```\n\nReturns the description string for the storage unit. This is typically displayed to the user in the user interface on the MTP host.\n\n| Return ||\n|----------------------------------------------------------------------------------|-----------------------------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | the storage unit description This value cannot be `null`. |\n\n### getFreeSpace\n\nAdded in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getFreeSpace(): Long\n```\n\nReturns the amount of free space in the storage unit in bytes\n\n| Return ||\n|------------------------------------------------------------------------------|--------------------------|\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | the amount of free space |\n\n### getMaxCapacity\n\nAdded in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getMaxCapacity(): Long\n```\n\nReturns the maximum storage capacity for the storage unit in bytes\n\n| Return ||\n|------------------------------------------------------------------------------|----------------------|\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | the maximum capacity |\n\n### getStorageId\n\nAdded in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getStorageId(): Int\n```\n\nReturns the storage ID for the storage unit. The storage ID uniquely identifies the storage unit on the MTP device.\n\n| Return ||\n|----------------------------------------------------------------------------|----------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the storage ID |\n\n### getVolumeIdentifier\n\nAdded in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getVolumeIdentifier(): String\n```\n\nReturns the volume identifier for the storage unit\n\n| Return ||\n|----------------------------------------------------------------------------------|------------------------------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | the storage volume identifier This value cannot be `null`. |"]]