Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom notification: java.lang.RuntimeException: bad array lengths
    primarykey
    data
    text
    <p>I'm trying to use custom notifications in my Android application using Google's sample from <a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html" rel="noreferrer">here</a> (section <a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomExpandedView" rel="noreferrer">Creating a Custom Notification Layout</a>). Since I'm using this exact code I got a <code>RuntimeException</code> every few times a notification is fired.</p> <p>My stack trace: </p> <pre><code>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) </code></pre> <p>My code:</p> <pre><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); ... } </code></pre> <p>If I replace the custom notification with a standard one (with <code>setLatestEventInfo()</code>) I have no problems.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload