Press the power key to turn off the screen and then display the keyguard when playing the slide in the android Image Library.

Source: Internet
Author: User

When the Image Library plays a slide, press the power key to disable the screen and then highlight the screen. The slides continue to play and no keyguard is displayed. How to display the unlock page after the screen is highlighted.

The modification method is to remove the FLAG_SHOW_WHEN_LOCKED flag. The modification positions on ICS2, JB, and JB2 are slightly different.

1. In ICS2 and JB versions, modify SCREEN_ON_FLAGS in the Gallery2 \ src \ com \ android \ gallery3d \ app \ ActivityState. java file as follows:Copy codeThe Code is as follows: private static final int SCREEN_ON_FLAGS = (
WindowManager. LayoutParams. FLAG_KEEP_SCREEN_ON
| WindowManager. LayoutParams. FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
// | WindowManager. LayoutParams. FLAG_SHOW_WHEN_LOCKED
);

2. In JB2, modify the onCreate () method of alps \ packages \ apps \ gallery2 \ src \ com \ android \ gallery3d \ app \ SlideshowPage. java:Copy codeThe Code is as follows: public void onCreate (Bundle data, Bundle restoreState ){
Super. onCreate (data, restoreState );
// MFlags | = (FLAG_HIDE_ACTION_BAR | FLAG_HIDE_STATUS_BAR
// | FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | FLAG_SHOW_WHEN_LOCKED );
MFlags | = (FLAG_HIDE_ACTION_BAR | FLAG_HIDE_STATUS_BAR
| FLAG_ALLOW_LOCK_WHILE_SCREEN_ON );
...
}

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.