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

  • Home
  • SEARCH
  • 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 6811891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:23:02+00:00 2026-05-26T20:23:02+00:00

I’m trying to use custom notifications in my Android application using Google’s sample from

  • 0

I’m trying to use custom notifications in my Android application using Google’s sample from here (section Creating a Custom Notification Layout).
Since I’m using this exact code I got a RuntimeException every few times a notification is fired.

My stack trace:

FATAL EXCEPTION: main
java.lang.RuntimeException: bad array lengths
    at android.os.Parcel.readIntArray(Parcel.java:677)
    at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag(INotificationManager.java:369)
    at android.app.NotificationManager.notify(NotificationManager.java:110)
    at android.app.NotificationManager.notify(NotificationManager.java:90)
    at com.****.service.UpdateFeedService.notifyUpdateProgress(UpdateFeedService.java:266)
    at com.****.service.task.PodcastUpdaterTask.onProgressUpdate(PodcastUpdaterTask.java:63)
    at com.****.service.task.PodcastUpdaterTask.onProgressUpdate(PodcastUpdaterTask.java:1)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:432)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:144)
    at android.app.ActivityThread.main(ActivityThread.java:4937)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    at dalvik.system.NativeStart.main(Native Method)

My code:

private final Intent updateInProgressIntent = new Intent(this.context, PodcastListActivity.class);
private RemoteViews updateInProgressContentView = null;
private PendingIntent updateInProgressPendingIntent = null;
private Notification updateInProgressNotification = null;
...
    @Override 
    public void onCreate() { 
        super.onCreate();    
...
        this.updateInProgressPendingIntent = PendingIntent.getActivity(this, UPDATE_INPROGRESS_NOTIFICATION_ID, 
        this.updateInProgressIntent, PendingIntent.FLAG_UPDATE_CURRENT);     
        this.updateInProgressContentView = new RemoteViews(getPackageName(), R.layout.custom_notification);
...
    }

    public void notifyUpdateProgress(final int index, final int size, final Podcast podcast) {

        this.updateInProgressContentView.setImageViewBitmap(
                R.id.image, ActivityHelper.getBitmap(context, podcast.getThumbnailAsset()));
        this.updateInProgressContentView.setTextViewText(R.id.title, "some msg");
        this.updateInProgressContentView.setTextViewText(R.id.text, podcast.getName());
        this.updateInProgressNotification.contentView = this.updateInProgressContentView;       
        this.updateInProgressNotification.contentIntent = this.updateInProgressPendingIntent;               
        this.notificationManager.notify(UPDATE_INPROGRESS_NOTIFICATION_ID, this.updateInProgressNotification);

        ...
        }       

If I replace the custom notification with a standard one (with setLatestEventInfo()) I have no problems.

  • 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-26T20:23:02+00:00Added an answer on May 26, 2026 at 8:23 pm

    Ok, so I finally find the solution.

    You cannot re-use the same RemoteView object like I did!

    I was creating the RemoteView in the onCreate() method, then I was setting its attributes in notifyUpdateProgress().

    If I create the object in notifyUpdateProgress() just before using it, I’m not having exception anymore.

    • 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 am trying to understand how to use SyndicationItem to display feed which is
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm making a simple page using Google Maps API 3. My first. One marker
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
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 want use html5's new tag to play a wav file (currently only supported

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.