Skip to content

Instantly share code, notes, and snippets.

@julianshen
Created January 15, 2011 10:59
Show Gist options
  • Save julianshen/780834 to your computer and use it in GitHub Desktop.
Save julianshen/780834 to your computer and use it in GitHub Desktop.
mStorageManager = (StorageManager) getSystemService(Service.STORAGE_SERVICE);
mStorageManager.mountObb("/sdcard/obbtest.obb", "android", new OnObbStateChangeListener() {
@Override
public void onObbStateChange(String path, int state) {
Log.d("OBBTEST", ""+path+" mount:"+state);
if(state == OnObbStateChangeListener.MOUNTED) {
String mountedPath = mStorageManager.getMountedObbPath("/sdcard/obbtest.obb");
if(mStorageManager.isObbMounted("/sdcard/obbtest.obb")) {
Log.d("OBBTEST", "mounted");
} else {
Log.d("OBBTEST", "not mounted");
File mFile = new File(mountedPath);
String[] fList = mFile.list();
for(String f:fList) {
Log.d("OBBTEST", f);
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment