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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:15:12+00:00 2026-06-09T02:15:12+00:00

I have an app that is set up to display an entry from a

  • 0

I have an app that is set up to display an entry from a database as a notification when it receives a broadcast. The _id for that database entry is passed as an extra for the broadcast’s intent. When the notification is clicked, the app is supposed to display that database entry in an activity.

So, here’s a code sample from the Broadcast Receiver:

Long itemID = intent.getLongExtra("com.my.app.receiver.ID", -1);
MyDatabaseHelper helper = new MyDatabaseHelper(context);
Log.i("MyApp", "Received item "+itemID);
Intent pending = new Intent(context, NotifyDisplay.class);
pending.putExtra("com.my.app.NOTIFY", itemID);
PendingIntent onNotifyClick = PendingIntent.getActivity(context,
                    1234567, pending, PendingIntent.FLAG_ONE_SHOT);

From there, the PendingIntent is thrown into a notification, and the activity just uses getIntent().getLongExtra() to grab that. However, LogCat shows a different story.

07-25 23:45:00.046: I/MyApp(19630): Received item 1
07-25 23:45:05.456: D/dalvikvm(19630): GC_EXPLICIT freed 47K, 52% free 3213K/6599K, external 6314K/7884K, paused 64ms
07-25 23:45:29.705: I/Notification(19630): Displaying task 0
07-25 23:45:29.755: D/AndroidRuntime(19630): Shutting down VM
07-25 23:45:29.755: W/dalvikvm(19630): threadid=1: thread exiting with uncaught exception (group=0x40015560)
07-25 23:45:29.847: E/AndroidRuntime(19630): FATAL EXCEPTION: main

Somehow, the app is now trying (and failing) to display the entirely wrong item. Can someone tell me why the extra is being changed as it’s being passed?

  • 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-09T02:15:14+00:00Added an answer on June 9, 2026 at 2:15 am

    I seemed to have solved the issue by using itemID.longValue() as the extra I’m putting into pending. Apparently, since getLongExtra() grabs primitive values, putting in a Long instead of a long causes issues.

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

Sidebar

Related Questions

I have a fairly large CRUD winform app that is set up to display
I have an Android app that begins by displaying a dialog. When I set
Right so I have a simple app that consists of a calendar a Set
I have set up an app that is registered for remote notifications. - (void)application:(UIApplication*)application
I'm creating an iPhone app that will have a preloaded set of locations with
I have a windows service that has it's name set by an app.config. I
I have a tab bar app that has to display in different languages depending
I have a custom RatingBar in my app that should display either the site
I have to store messages that my web app fetch from Twitter into a
I have a Silverlight Windows Phone 7 app that pulls data from a public

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.