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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:52:07+00:00 2026-06-19T03:52:07+00:00

I have ArrayList of object that I query from database and I want to

  • 0

I have ArrayList of object that I query from database and I want to notify all of my objects to remove them when user touch on notification.

I put each id of my object to intent and start intent to remove it but the problem is when I touch on notification the id of first item is correct but but the others is not it stills the first id.

This is the code

for(int i=0;i<listItem.size();i++){
        String message = "Remove \""+listItem.get(i).getName()+"\" "+listItem.get(i).getID();
        intent.putExtra("id", listItem.get(i).getID());
        String s = intent.getExtras().getString("ID");
        Toast.makeText(getApplicationContext(),"id : "+s, Toast.LENGTH_SHORT).show();
        Notification notification = new Notification(R.drawable.icon_noti,message,new Date().getTime());
        PendingIntent pI = PendingIntent.getActivity(getApplicationContext(), 1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        notification.flags = Notification.FLAG_AUTO_CANCEL;
        NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        notification.setLatestEventInfo(getApplicationContext(), message, "Touch to remove" , pI);
        notification.sound = soundUri;
        notificationManager.notify(i,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-06-19T03:52:08+00:00Added an answer on June 19, 2026 at 3:52 am

    This happens because when you call

    PendingIntent pI = PendingIntent.getActivity(getApplicationContext(), 1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    

    you provide a static request id with value “1”, so the method returns you the same PendingIntent every time. To create different PendingIntents for every item, provide unique request ids’ for every call. Hope this helps.

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

Sidebar

Related Questions

I have an ArrayList that I want to use to hold RaceCar objects that
i have a method that return a ArrayList from a sqlite query, only a
I have a byte[] that i obtained using Object ArrayList<Obj> Can anyone tell me
I have an arraylist of objects in my servlet where I want to call
I have two arraylist with a number of model objects.I want to find the
I have an arraylist that holds a subset of names found in my database.
I have a database with tables and values. I want to fetch that data
I have a program that collects information from the database. in my previous question
Hy!! I have a listview that should be filled with data from the database
I have a query in Data Access Object DAOComments that joins users table and

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.