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 8259007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:44:39+00:00 2026-06-08T02:44:39+00:00

I’m trying to get my screen to go dim when I call an activity

  • 0

I’m trying to get my screen to go dim when I call an activity from a notification. Here is the code I am using:

WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = 0.01f;
getWindow().setAttributes(lp);  

Maybe I am doing something wrong here, if so can someone tell me whats going on and why its not working the way its supposed to?!

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;


public class NoteMe extends Activity {
/** Called when the activity is first created. */
NotificationManager nm;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String title = "Example text";
    String contentText = "Full hello world!";
    String text = "Starting Notification!";

    nm = (NotificationManager) this
            .getSystemService(Context.NOTIFICATION_SERVICE);
    long when = System.currentTimeMillis();
    int icon = R.drawable.ic_launcher;

    Intent intent = new Intent(getBaseContext(), MainActivity.class);
    PendingIntent contentIntent = PendingIntent.getActivity(
            getBaseContext(), 0, intent, 0);

    Notification notification = new Notification(icon, text, when);
    notification.setLatestEventInfo(getBaseContext(), title, contentText,
            contentIntent);
    notification.flags = Notification.FLAG_ONGOING_EVENT;
    int NOTIFICATION_ID = 10;
    nm.notify(NOTIFICATION_ID, notification);
}
}

Here is the requested code

  • 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-08T02:44:42+00:00Added an answer on June 8, 2026 at 2:44 am

    You code is 100% correct. There are two possibilities the first is the most likely

    1) The activity is not getting called off the notification. I believe there is a special way that you fire off from a notification involving pending intents. I would guess thats the problem. Just to be sure put some breakpoints in onCreate and onStart to see if it ever gets called. Or just put a log statement near your code to see if it gets called. I’m guessing it never gets called.

    2) The adjustment you are making 0.1f is not visible change.

    Please review this and just make sure notifications are being received:

    http://www.vogella.com/articles/AndroidNotifications/article.html

    One difference I see is getContextBase() vs. this

    If its not that it looks like maybe MainActivity.class manifest declaration might not be right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

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.