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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:47:00+00:00 2026-06-06T06:47:00+00:00

I have 3 errors in the code of notification using OnItemClickListener i need to

  • 0

I have 3 errors in the code of notification using OnItemClickListener
i need to apply that when an item is clicked it display notification
here is the code:

    list.setOnItemClickListener(new OnItemClickListener(){

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO Auto-generated method stub


            Bundle programNum = getIntent().getExtras();
            final String progNum = programNum.getString("ProgNum");
            final String dayNum = programNum.getString("DayNum");

            final List<TouringPrograms> startTime = datasource.getTouringProgramsStartTime(progNum, dayNum);
            final List<TouringPrograms> endTime = datasource.getTouringProgramsEndTime(progNum, dayNum);

            Intent intent = new Intent(this, ProgramsList2.class);
            PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
            String body = (String) ((TextView)parent.getChildAt(position)).getText();
            String title = "Egypt On The Go";
            String time = body + "\n start at:" + startTime.get(position)+ "\n end at:" + endTime.get(position);
            Notification n = new Notification(R.drawable.egypt, time, System.currentTimeMillis());
            n.setLatestEventInfo(this, title, time, pi);
            n.defaults = Notification.DEFAULT_ALL;
            nm.notify(uniqueID, n);
            //String time1 = "" + System.currentTimeMillis();
            //Toast.makeText(this, time1, Toast.LENGTH_SHORT).show();
            //finish();

        }});

the 3 error :

1.Intent intent = new Intent(this, ProgramsList2.class);

2.PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);

3.n.setLatestEventInfo(this, title, time, pi);

any help please?

  • 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-06T06:47:01+00:00Added an answer on June 6, 2026 at 6:47 am

    Error 1

    Intent intent = new Intent(this, ProgramsList2.class);
    

    this is an item of type OnItemClickListener. You should pass it by declaring final Context intentContext = (Context) this; before calling setOnItemClickListener. Then, use:

    Intent intent = new Intent(intentContext, ProgramsList2.class);
    

    Always remember to keep track of your Context items; they’re important for things like this (Intents, resources, assets, etc.).

    Error 2

    PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
    

    Exactly the same problem as above. this is not of type Context. Use the same fix as above.

    Error 3

    n.setLatestEventInfo(this, title, time, pi);
    

    And here, same issue as the above two. You’re using this when you should be using a Context. Same fix as the above two.

    Summary

    Keep track of your thiss when using anonymous classes. And for the future, posting the compile errors (the line of code as well as the text of the error itself) is incredibly helpful to those who will provide answers.

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

Sidebar

Related Questions

I have a code that generates errors on my PC but does't on other
I have a code that works in Matlab version R2010a but shows errors in
I have this code: <script id=toModify > Invalid javascript that will cause errors </script>
Here's my problem I have some code and I'm using it to send an
I have some HTML errors in my output source code, coming from one of
I have this code to suppress all errors. When an error occurs a blank
i have this php code and keep on getting errors upon fixing each error.
I have the following code (changed object names, so syntax/spelling errors ignore). public class
I have a line of php code that looks like this: echo <script>$('#edit_errors').html('<h3><em>Please Correct
I have a small WinForms application that sends notification emails. It works fine with

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.