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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:52:32+00:00 2026-05-24T12:52:32+00:00

I have problem to make popup unvisible. When I press to show it becomes

  • 0

I have problem to make popup unvisible. When I press to show it becomes visible but when I press Cancel button ( Cance button is on popup) it doesn’t become unvisible but it pass normal through code and nothing.

final PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.popup,
            null, false), 300, 300, true);

    View layout = inflater.inflate(R.layout.popup,
            (ViewGroup) findViewById(R.id.llPopup));

    Button btnOK = (Button) layout.findViewById(R.id.btnOK);
    Button btnCancel = (Button) layout.findViewById(R.id.btnCancel);
    btnCancel.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            // TODO Auto-generated method stub
            if (pw != null) {
                pw.dismiss();
            }

        }
    });

this is popup.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:padding="10dip"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#AAAAAAAA"
    android:id="@+id/llPopup"
    >


<LinearLayout 
    android:orientation="horizontal"
    android:padding="10dip"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
>
<TextView 
    android:id="@+id/txtSearchBy"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Search By:"
/>
    <RadioGroup
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="right"
      android:orientation="vertical">
      <RadioButton
        android:id="@+id/rbPrice"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Time" />
      <RadioButton
        android:id="@+id/rbDuration"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Price" />
      <RadioButton
        android:id="@+id/rbLongitude"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Longitude" />
    </RadioGroup>

</LinearLayout>



    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"

        >
        <Button 
            android:id="@+id/btnCancel"
            android:layout_width="100sp"
            android:layout_height="wrap_content"
            android:text="Cancel"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
        />

        <Button 
            android:id="@+id/btnOK"
            android:layout_width="100sp"
            android:layout_height="wrap_content"
            android:text="OK"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
        />

    </RelativeLayout>


</LinearLayout>

What I make wrong can anybody help me ?

  • 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-24T12:52:34+00:00Added an answer on May 24, 2026 at 12:52 pm
    View layout = inflater.inflate(R.layout.popup,
            (ViewGroup) findViewById(R.id.llPopup));
    
    final PopupWindow pw = new PopupWindow(layout, 300, 300, true);
    
    Button btnOK = (Button) layout.findViewById(R.id.btnOK);
    Button btnCancel = (Button) layout.findViewById(R.id.btnCancel);
    btnCancel.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            // TODO Auto-generated method stub
            if (pw != null) {
                pw.dismiss();
            }
    
        }
    });
    

    Each time you call inflate method you are creating a new View; thus, the cancel button that you set the listener to is different from the one that is inside the popup. As you can see above, the same View is used to both: initialize the popup and set the click listener.

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

Sidebar

Related Questions

I have to make a simple layout in android but have problem with the
Trying to make simple minesweeper game in python, but have one problem. I have
I have the following problem: I make the call to the method of a
I have problem with base classes in WPF. I try to make a base
I have following problem: I have to make a ASP.NET Webapplication with a two-row
i have a problem with a scripts below and How to make multification results
I have a problem with datePicker. When a make a new text field with
I have a huge problem with this method im trying to make. I have
I make the problem shorter. Actually I have data much longer than this. I
I have a little problem, I need to make directory from my c code

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.