Dela via


LiveFolders Class

Definition

Caution

This class is obsoleted in this android platform

A LiveFolder is a special folder whose content is provided by a android.content.ContentProvider.

[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
[<Android.Runtime.Register("android/provider/LiveFolders", DoNotGenerateAcw=true)>]
[<System.Obsolete("This class is obsoleted in this android platform")>]
type LiveFolders = class
    inherit Object
Inheritance
LiveFolders
Attributes

Remarks

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

<ul> <li>An activity that can respond to the intent action #ACTION_CREATE_LIVE_FOLDER. The activity is responsible for creating the live folder.</li> <li>A android.content.ContentProvider to provide the live folder items.</li> </ul>

<h3>Lifecycle</h3>

When a user wants to create a live folder, the system looks for all activities with the intent filter action #ACTION_CREATE_LIVE_FOLDER and presents the list to the user. When the user chooses one of the activities, the activity is invoked with the #ACTION_CREATE_LIVE_FOLDER action. The activity then creates the live folder and passes it back to the system by setting it as an android.app.Activity#setResult(int, android.content.Intent) activity result. 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.

<h3>Setting up the live folder activity</h3>

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

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;
                }
            }

The live folder is described by an android.content.Intent as follows:

<table border="2" width="85%" align="center" frame="hsides" rules="rows"> <thead> <tr><th>Component</th> <th>Type</th> <th>Description</th> <th>Required</th></tr> </thead>

<tbody> <tr><th>URI</th> <td>URI</td> <td>The ContentProvider URI</td> <td align="center">Yes</td> </tr> <tr><th>#EXTRA_LIVE_FOLDER_NAME</th> <td>Extra String</td> <td>The name of the live folder</td> <td align="center">Yes</td> </tr> <tr><th>#EXTRA_LIVE_FOLDER_ICON</th> <td>Extra android.content.Intent.ShortcutIconResource</td> <td>The icon of the live folder</td> <td align="center">Yes</td> </tr> <tr><th>#EXTRA_LIVE_FOLDER_DISPLAY_MODE</th> <td>Extra int</td> <td>The display mode of the live folder. The value must be either #DISPLAY_MODE_GRID or #DISPLAY_MODE_LIST.</td> <td align="center">Yes</td> </tr> <tr><th>#EXTRA_LIVE_FOLDER_BASE_INTENT</th> <td>Extra Intent</td> <td>When 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.</td> <td align="center">No</td> </tr> </tbody> </table>

<h3>Setting up the content provider</h3>

The live folder's content provider must, upon query, return a android.database.Cursor whose columns match the following names:

<table border="2" width="85%" align="center" frame="hsides" rules="rows"> <thead> <tr><th>Column</th> <th>Type</th> <th>Description</th> <th>Required</th></tr> </thead>

<tbody> <tr><th>#NAME</th> <td>String</td> <td>The name of the item</td> <td align="center">Yes</td> </tr> <tr><th>#DESCRIPTION</th> <td>String</td> <td>The description of the item. The description is ignored when the live folder's display mode is #DISPLAY_MODE_GRID.</td> <td align="center">No</td> </tr> <tr><th>#INTENT</th> <td>android.content.Intent</td> <td>The intent to fire when the item is clicked. Ignored when the live folder defines a base intent.</td> <td align="center">No</td> </tr> <tr><th>#ICON_BITMAP</th> <td>Bitmap</td> <td>The icon for the item. When this column value is not null, the values for the columns #ICON_PACKAGE and #ICON_RESOURCE must be null.</td> <td align="center">No</td> </tr> <tr><th>#ICON_PACKAGE</th> <td>String</td> <td>The package of the item's icon. When this value is not null, the value for the column #ICON_RESOURCE must be specified and the value for the column #ICON_BITMAP must be null.</td> <td align="center">No</td> </tr> <tr><th>#ICON_RESOURCE</th> <td>String</td> <td>The resource name of the item's icon. When this value is not null, the value for the column #ICON_PACKAGE must be specified and the value for the column #ICON_BITMAP must be null.</td> <td align="center">No</td> </tr> </tbody> </table>

This member is deprecated. Live folders are no longer supported by Android. These have been replaced by the new AppWidget Collection APIs introduced in android.os.Build.VERSION_CODES#HONEYCOMB. These provide all of the features of live folders plus many more. The use of live folders is greatly discouraged because of security issues they introduce -- publishing a live folder requires making all data show for the live folder available to all applications with no permissions protecting it.

Java documentation for android.provider.LiveFolders.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

ActionCreateLiveFolder
Obsolete.

Activity Action: Creates a live folder.

Description
Obsolete.

Content provider column.

ExtraLiveFolderBaseIntent
Obsolete.

The name of the extra used to define the base Intent of a live folder.

ExtraLiveFolderDisplayMode
Obsolete.

The name of the extra used to define the display mode of a live folder.

ExtraLiveFolderIcon
Obsolete.

The name of the extra used to define the icon of a live folder.

ExtraLiveFolderName
Obsolete.

The name of the extra used to define the name of a live folder.

IconBitmap
Obsolete.

Content provider column.

IconPackage
Obsolete.

Content provider column.

IconResource
Obsolete.

Content provider column.

Intent
Obsolete.

Content provider column.

Name
Obsolete.

Content provider column.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to