-7

I need to use the following line in service class

getWindow().getDecorView().setSystemUiVisibility(8);

Please anyone help.

user4232
  • 592
  • 1
  • 12
  • 37
Pri M
  • 11
  • 1
  • 4

1 Answers1

0

A service can not set window properties, since it has no view/UI. You must send an event to your activity, which must set this property. When it comes to sending the event to activity, you can use several mechanisms:

  1. Use a messenger which you passed from activity to service earlier
  2. Use AIDL interface
  3. Easiest : Send a broadcast Intent from your Service class, let your Activity listen for that broadcast, and set the action on UI thread
Ankur Aggarwal
  • 2,210
  • 2
  • 34
  • 39