简体   繁体   中英

Setting FLAG_KEEP_SCREEN_ON of an activity from another activity

I have an activity which calls another activity(not by intent,through an sdk which is not open source). The second activity is a MediaPlayer , since I don't have access to the code of that activity and it is in a jar file, I want to set its FLAG_KEEP_SCREEN_ON activity from some other activity. My intention here is to prevent the screen from turning off during the play of the video in the MediaPlayer.
I'll appreciate if you can help me with this.
Thanks

You can't, but you can probably do something similar. When you launch the activity, use startActivityForResult. At the same time, take a wakelock that keeps the screen on. When onActivityResult is called, release the wakelock.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM