Create a Real-Time folder for Android

Source: Internet
Author: User

The following is an example of the SDK:

First, you must add<Action Android: Name = "android. Intent. Action. create_live_folder"/>

Then the analysis is as follows:

Public class mylivefolder extends activity {
Public static final URI content_uri = URI. parse ("content: // my. APP/live ");

Protected void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
// Get intent
Final intent = getintent (); // obtain the action set in androidmanifest
Final string action = intent. getaction ();
// Determine
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, Uri, string name,
Int icon ){

Final intent = new intent ();
// Set the data address
Intent. setdata (URI); // you can specify the Real-Time folder name.
Intent. putextra (livefolders. extra_live_folder_name, name); // sets the image of the real-time folder.
Intent. putextra (livefolders. extra_live_folder_icon,
Intent. shortcuticonresource. fromcontext (context, icon); // sets the display mode for real-time folders. One is the list mode, and the other is the nine cells mode.
Intent. putextra (livefolders. extra_live_folder_display_mode, livefolders. display_mode_list );

Return intent;
}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.