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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:12:21+00:00 2026-05-17T20:12:21+00:00

There are several threads already on how to make custom layouts in the notification

  • 0

There are several threads already on how to make custom layouts in the notification bar. The problem is I must be missing something simple.

I have a custom_notification_layout.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:padding="3dip"
              >

    <TextView android:id="@+id/text"
              android:text="Uploading"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textColor="#000"
              />

    <ProgressBar  
            style="?android:attr/progressBarStyleHorizontal" 
            android:layout_height="wrap_content" 
            android:layout_width="fill_parent"
            android:max="0" 
            android:progress="0"   
            android:layout_marginLeft="10dip"  
            android:id="@+id/progressBar" 
            />  
</LinearLayout>

I also have some test code that creates the notification, which works and shows the progress bar.

NotificationManager mManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon, title, System.currentTimeMillis());
RemoteViews contentView = new RemoteViews(context.getPackageName(), R.layout.custom_notification_layout);
contentView.setProgressBar(R.id.progressBar, 10, 0, false);        
contentView.setTextViewText(R.id.text, text);       
notification.contentView = contentView;

Intent notificationIntent = new Intent(context, NotificationHandler.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.contentIntent = contentIntent;
mManager.notify(APPID, notification);

Finally I try to update the progress bar, which doesn’t work.

contentView.setProgressBar(R.id.progressBar, 10, 5, false); 

What is the secret to actually updating the notification?

  • 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-05-17T20:12:21+00:00Added an answer on May 17, 2026 at 8:12 pm

    You should add these two lines:

    // update the notification object
    notification.contentView.setProgressBar(R.id.progressBar, 10, 5, false);
    // notify the notification manager on the update.
    mManager.notify(APPID, notification);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program with several worker threads, and a main thread that receives
I want to run several threads inside a process. I'm looking for the most
Apologies if there is a thread for this already, I couldn't find one that
Suppose we have a map that is shared between multiple threads. It represents a
I have some status data that I want to cache from a database. Any
I'm working on a graphical application which looks something like this: while (Simulator.simulating) {
Here's the scenario: I have a multi threaded java web application which is running
While designing a fairly simple backup system for Linux in python, I'm finding myself
Several of my Android applications show the following type message in the logcat output:
I have a list of files, which need to be read, in chunks, into

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.