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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:29:18+00:00 2026-05-15T15:29:18+00:00

I am trying to display the options menu when a list item is checked

  • 0

I am trying to display the options menu when a list item is checked in my app. I am doing this by broadcasting an intent when the checkbox is clicked via a listener and a helper class that extends Activity. My code for the helper class is:

public class menuHelper extends Activity{

    private void showMenu(int checked){

        try{
            Intent intent = new Intent(SHOW_MENU);
            intent.putExtra("check", checked);
            sendBroadcast(intent);
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
}

The problem is when the sendBroadcast method is invoked. An exception is thrown and the stack trace states that it is a NullPointerException at sendBroadcast(intent). As far as I can tell, the intent is not null, but I am missing something here because the exception is thrown.

  • 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-15T15:29:19+00:00Added an answer on May 15, 2026 at 3:29 pm

    It appears that calling the sendBroadcast() method from within an adapter (regardless of using a subclass extending Activity to do so) is simply illegal.

    To implement my desired functionality I found that if you inject the calling activity into the adapter class and call a method from the activity to display (or hide) the options menu this null pointer error does not occur and the menu displays or not beautifully.

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

Sidebar

Related Questions

I'm trying to display a tooltip or hover-text in a list-menu whereby if the
Trying to display current time with PHP (using this ): $date = date('m/d/Y h:i:s
I am trying to display my popover menu whenever the user clicks on a
To whom it may concern, I am trying to make a list navigation menu
I'm trying to construct a database driven VB.Net app that pulls a list of
So I have a list of menu items and I'm trying to figure out
I'm trying to create a list of videos that a user may view. This
I am trying to display my command objects collection field inside a list box.
I'm trying to get my options menu to show up in the new Android
I'm trying to Display/Hide some select box options depending on the select values from

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.