0

I am using action bar using following code,

 ActionBar actionBar = getActionBar();
 actionBar.setCustomView(R.layout.custom_action);
 actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM
                    | ActionBar.DISPLAY_SHOW_HOME);

According to above code there is symbol/operator single vertical bar (|) in method called actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);

so what is meaning of that single vertical bar ( | )..??

Howli
  • 12,291
  • 19
  • 47
  • 72
Umang Kothari
  • 3,674
  • 27
  • 36

1 Answers1

1

The operator | does a "bitwise OR". The output of bitwise OR on two bits is 1 if either bit is 1 or 0 if both bits are 0. Bitwise OR on two numbers just does a bitwise OR on each bit individually.

Heres how 3|4 works:

  3:  00000011
  4:  00000100
--------------
3|4:  00000111 = 7

reference

Community
  • 1
  • 1
CompEng
  • 7,161
  • 16
  • 68
  • 122