Android.Provider.LiveFolders Class

Lifecycle

Setting up the live folder activity

java Example

 public static class MyLiveFolder extends Activity {
     public static final Uri CONTENT_URI = Uri.parse("content://my.app/live");

     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

         final Intent intent = getIntent();
         final String action = intent.getAction();

         if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
             setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI, "My LiveFolder",
                     R.drawable.ic_launcher_contacts_phones));
         } else {
             setResult(RESULT_CANCELED);
         }

         finish();
     }

     private static Intent createLiveFolder(Context context, Uri uri, String name,
             int icon) {

         final Intent intent = new Intent();

         intent.setData(uri);
         intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, name);
         intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON,
                 Intent.ShortcutIconResource.fromContext(context, icon));
         intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE, LiveFolders.DISPLAY_MODE_LIST);

         return intent;
     }
 }
 
ComponentTypeDescriptionRequired
URIURIThe ContentProvider URIYes
LiveFolders.ExtraLiveFolderNameExtra StringThe name of the live folderYes
LiveFolders.ExtraLiveFolderIconExtra NoType:android/content/Intent$ShortcutIconResource;Href=../../../reference/android/content/Intent.ShortcutIconResource.htmlThe icon of the live folderYes
LiveFolders.ExtraLiveFolderDisplayModeExtra intThe display mode of the live folder. The value must be either LiveFolders.DISPLAY_MODE_GRID or LiveFolders.DISPLAY_MODE_LIST.Yes
LiveFolders.ExtraLiveFolderBaseIntentExtra IntentWhen the user clicks an item inside a live folder, the system will either fire the intent associated with that item or, if present, the live folder's base intent with the id of the item appended to the base intent's URI.No

Setting up the content provider

ColumnTypeDescriptionRequired
LiveFolders.NameStringThe name of the itemYes
LiveFolders.DescriptionStringThe description of the item. The description is ignored when the live folder's display mode is LiveFolders.DISPLAY_MODE_GRID.No
LiveFolders.IntentAndroid.Content.IntentThe intent to fire when the item is clicked. Ignored when the live folder defines a base intent.No
LiveFolders.IconBitmapBitmapThe icon for the item. When this column value is not null, the values for the columns LiveFolders.IconPackage and LiveFolders.IconResource must be null.No
LiveFolders.IconPackageStringThe package of the item's icon. When this value is not null, the value for the column LiveFolders.IconResource must be specified and the value for the column LiveFolders.IconBitmap must be null.No
LiveFolders.IconResourceStringThe resource name of the item's icon. When this value is not null, the value for the column LiveFolders.IconPackage must be specified and the value for the column LiveFolders.IconBitmap must be null.No

See Also: LiveFolders Members

Syntax

[Android.Runtime.Register("android/provider/LiveFolders", DoNotGenerateAcw=true)]
[System.Obsolete("This class is obsoleted in this android platform")]
public sealed class LiveFolders : Java.Lang.Object

Remarks

Lifecycle

Setting up the live folder activity

java Example

 public static class MyLiveFolder extends Activity {
     public static final Uri CONTENT_URI = Uri.parse("content://my.app/live");

     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

         final Intent intent = getIntent();
         final String action = intent.getAction();

         if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
             setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI, "My LiveFolder",
                     R.drawable.ic_launcher_contacts_phones));
         } else {
             setResult(RESULT_CANCELED);
         }

         finish();
     }

     private static Intent createLiveFolder(Context context, Uri uri, String name,
             int icon) {

         final Intent intent = new Intent();

         intent.setData(uri);
         intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, name);
         intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON,
                 Intent.ShortcutIconResource.fromContext(context, icon));
         intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE, LiveFolders.DISPLAY_MODE_LIST);

         return intent;
     }
 }
 
ComponentTypeDescriptionRequired
URIURIThe ContentProvider URIYes
LiveFolders.ExtraLiveFolderNameExtra StringThe name of the live folderYes
LiveFolders.ExtraLiveFolderIconExtra NoType:android/content/Intent$ShortcutIconResource;Href=../../../reference/android/content/Intent.ShortcutIconResource.htmlThe icon of the live folderYes
LiveFolders.ExtraLiveFolderDisplayModeExtra intThe display mode of the live folder. The value must be either LiveFolders.DISPLAY_MODE_GRID or LiveFolders.DISPLAY_MODE_LIST.Yes
LiveFolders.ExtraLiveFolderBaseIntentExtra IntentWhen the user clicks an item inside a live folder, the system will either fire the intent associated with that item or, if present, the live folder's base intent with the id of the item appended to the base intent's URI.No

Setting up the content provider

ColumnTypeDescriptionRequired
LiveFolders.NameStringThe name of the itemYes
LiveFolders.DescriptionStringThe description of the item. The description is ignored when the live folder's display mode is LiveFolders.DISPLAY_MODE_GRID.No
LiveFolders.IntentAndroid.Content.IntentThe intent to fire when the item is clicked. Ignored when the live folder defines a base intent.No
LiveFolders.IconBitmapBitmapThe icon for the item. When this column value is not null, the values for the columns LiveFolders.IconPackage and LiveFolders.IconResource must be null.No
LiveFolders.IconPackageStringThe package of the item's icon. When this value is not null, the value for the column LiveFolders.IconResource must be specified and the value for the column LiveFolders.IconBitmap must be null.No
LiveFolders.IconResourceStringThe resource name of the item's icon. When this value is not null, the value for the column LiveFolders.IconPackage must be specified and the value for the column LiveFolders.IconBitmap must be null.No

A LiveFolder is a special folder whose content is provided by a Android.Content.ContentProvider. To create a live folder, two components are required:

When a user wants to create a live folder, the system looks for all activities with the intent filter action LiveFolders.ActionCreateLiveFolder and presents the list to the user. When the user chooses one of the activities, the activity is invoked with the LiveFolders.ActionCreateLiveFolder action. The activity then creates the live folder and passes it back to the system by setting it as an Android.App.Activity.SetResult(Android.App.Result, Android.Content.Intent). The live folder is described by a content provider URI, a name, an icon and a display mode. Finally, when the user opens the live folder, the system queries the content provider to retrieve the folder's content.

The following code sample shows how to write an activity that creates a live folder:

The live folder is described by an Android.Content.Intent as follows:

The live folder's content provider must, upon query, return a Android.Database.ICursor whose columns match the following names:

[Android Documentation]

Requirements

Namespace: Android.Provider
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 3Deprecated since API level 14