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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:31:57+00:00 2026-05-22T02:31:57+00:00

I am writing an Android app in which I have a Map activity where

  • 0

I am writing an Android app in which I have a Map activity where I have a few buttons and what not. I have a map.xml for the layout for this. In this map I set annotations and the “annotation balloons” for this by using this library I found online (I forgot the name but I’ll find it if you guys want to know). This part works fine. The problem occurs when I put a button in another xml (put a button in the “annotation balloon” overlay xml) that is used for annotation balloons. I would like to detect the click in my map activity but it seems that it never goes in the onClick method. This is what I am doing in my activity to set the listener:

    LinearLayout layout = new LinearLayout(getApplicationContext());
    LayoutInflater inflater = (LayoutInflater) getApplicationContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = inflater.inflate(R.layout.balloon_overlay, layout);

    Button quickPathfindButton = (Button) v.findViewById(R.id.map_quickpathfind_button);
    quickPathfindButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            quickPathfind();
        }
    });

It seems that it never goes in the onClick method. Do you guys know why this could be the case? Let me know if you don’t understand my question. It is very hard to word it.

Thanks!

  • 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-22T02:31:58+00:00Added an answer on May 22, 2026 at 2:31 am

    You are attaching the listener to the button in a view hierarchy that isn’t part of the activity. Try setting the onClick attribute of the button in the xml and writing the method in your activity. It should then automagically call the method when clicked.

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

Sidebar

Related Questions

I'm writing an Android app. I have a main method, which creates and runs
I am writing a simple android app which have a edittext and a button.
So I'm writing an Android app which uses a large c++ library. I have
So I'm writing an android app, and I have an xml parser class that
I am writing an Android app, part of which will be a survey involving
I'm writing an android app and in it I want to have a sort
I'm writing app for android device, which is simple download manager. I want to
I am writing an app for android which uses InputStream from Socket . I
I'm writing an Android application which requires the user to login. I have a
I'm writing an Android App and I'm looking for the fastest (In terms of

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.