Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9111105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:25:39+00:00 2026-06-17T03:25:39+00:00

I tried searching using Google Search and Stack Overflow, but it didn’t show up any

  • 0

I tried searching using Google Search and Stack Overflow, but it didn’t show up any results. I have seen this in opensource library code:

Notification notification = new Notification(icon, tickerText, when);
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_VIBRATE;

What does “|=” ( pipe equal operator ) mean?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:25:40+00:00Added an answer on June 17, 2026 at 3:25 am

    |= reads the same way as +=.

    notification.defaults |= Notification.DEFAULT_SOUND;
    

    is the same as

    notification.defaults = notification.defaults | Notification.DEFAULT_SOUND;
    

    where | is the bit-wise OR operator.

    All operators are referenced here.

    A bit-wise operator is used because, as is frequent, those constants enable an int to carry flags.

    If you look at those constants, you’ll see that they’re in powers of two :

    public static final int DEFAULT_SOUND = 1;
    public static final int DEFAULT_VIBRATE = 2; // is the same than 1<<1 or 10 in binary
    public static final int DEFAULT_LIGHTS = 4; // is the same than 1<<2 or 100 in binary
    

    So you can use bit-wise OR to add flags

    int myFlags = DEFAULT_SOUND | DEFAULT_VIBRATE; // same as 001 | 010, producing 011
    

    so

    myFlags |= DEFAULT_LIGHTS;
    

    simply means we add a flag.

    And symmetrically, we test a flag is set using & :

    boolean hasVibrate = (DEFAULT_VIBRATE & myFlags) != 0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried searching in google but could not find any useful answer, if(verifier.length() >
I tried searching in Google, but I could not find any good examples where
I tried searching for this but my Google has failed me. I have a
I tried searching for this but couldn't find a similar question. I have a
I tried searching and didn't find anything that fixed my problem. I have a
I have tried searching over the internet about this problem but not able to
I've tried searching through search engines,MSDN,etc. but can't anything. Sorry if this has been
I've tried searching this on Google and here but nothing like the issue I'm
Okay, I've tried using Google-sensei and searching around on this website, and while I've
I tried searching in google but it just shows what I'm not looking for.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.