コード例 #1
0
  public void refreshCategoryInfo() {
    // clear
    for (FileCategory fc : sCategories) {
      setCategoryInfo(fc, 0, 0);
    }

    // query database
    String volumeName = "external";

    Uri uri = Audio.Media.getContentUri(volumeName);
    refreshMediaCategory(FileCategory.Music, uri);

    uri = Video.Media.getContentUri(volumeName);
    refreshMediaCategory(FileCategory.Video, uri);

    uri = Images.Media.getContentUri(volumeName);
    refreshMediaCategory(FileCategory.Picture, uri);

    uri = Files.getContentUri(volumeName);
    refreshMediaCategory(FileCategory.Theme, uri);
    refreshMediaCategory(FileCategory.Doc, uri);
    refreshMediaCategory(FileCategory.Zip, uri);
    refreshMediaCategory(FileCategory.Apk, uri);
  }
コード例 #2
0
 private Uri getContentUriByCategory(FileCategory cat) {
   Uri uri;
   String volumeName = "external";
   switch (cat) {
     case Theme:
     case Doc:
     case Zip:
     case Apk:
       uri = Files.getContentUri(volumeName);
       break;
     case Music:
       uri = Audio.Media.getContentUri(volumeName);
       break;
     case Video:
       uri = Video.Media.getContentUri(volumeName);
       break;
     case Picture:
       uri = Images.Media.getContentUri(volumeName);
       break;
     default:
       uri = null;
   }
   return uri;
 }