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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:46:48+00:00 2026-05-28T05:46:48+00:00

I have extended my class with a dialog in which I have set content

  • 0

I have extended my class with a dialog in which I have set content view and other button actionlisteners etc… what is happening is that when I create my dialog it shows background properly.

but opening it again and again is crating problems with content view, things are added haphazardly and most of the UI elements are repeating and background image is disappeared.

I know that dialog is created once and is used as a cache, I don’t want that I know there is a method in Android Activity removeDialog(int dialogID) but I don’t know who to use this, I don’t give any id to my dialog I don’t know how to give id to dialog.

#dialog code

public class OptionsDailog extends Dialog implements OnClickListener {
        public OptionsDailog(Activity pContext) {
        super(pContext, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
        mContext = pContext;
        setContentView(R.layout.option_menu);
        setBasicContents();
    }

#options_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:id="@+id/rl_root_option_menu">
    <RelativeLayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:background="@drawable/bg_episode" android:id="@+id/rl_option_screen">
        <LinearLayout android:id="@+id/ll_options" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true">
            <Button android:text="Achievements" android:textSize="18sp" android:id="@+id/btn_achievements" android:background="@drawable/bg_options_menu" android:textColor="#FFFFFF" android:layout_width="250dp" android:layout_height="60dp"></Button>
            <Button android:text="Tutorial" android:textSize="18sp" android:id="@+id/btn_tutorial" android:background="@drawable/bg_options_menu" android:textColor="#FFFFFF" android:layout_width="250dp" android:layout_height="60dp"></Button>
            <Button android:text="Leaderboard" android:textSize="18sp" android:id="@+id/btn_leaderboard" android:background="@drawable/bg_options_menu" android:textColor="#FFFFFF" android:layout_width="250dp" android:layout_height="60dp"></Button>
            <Button android:id="@+id/btn_music" android:text="Music" android:textSize="18sp" android:background="@drawable/bg_options_menu" android:textColor="#FFFFFF" android:layout_width="250dp" android:layout_height="60dp"></Button>
            <Button android:id="@+id/btn_sound" android:textSize="18sp" android:text="Sound" android:layout_marginBottom="10dip" android:background="@drawable/bg_options_menu" android:textColor="#FFFFFF" android:layout_width="250dp" android:layout_height="60dp"></Button>
        </LinearLayout>
    </RelativeLayout>
    <ImageButton android:background="@drawable/btn_back" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_marginRight="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ib_back_options_menu"></ImageButton>
</RelativeLayout>

#Dialog showing code
final OptionsDailog mDailog = new OptionsDailog(JungleCrashLand.this);
            mDailog.show();
  • 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-28T05:46:49+00:00Added an answer on May 28, 2026 at 5:46 am

    The Dialog class works with its own set of identifiers. If you create a dialog with createDialog(int x) you can pass this x as your own identifier. removing the dialog follows the same structure: removeDialog(int x) where x is, again, the identifier of your dialog type. It is done this way to be able to distinguish between different “types” of dialogs, defined by your own, without the need to extend the dialog class.

    so basically:

    static final int OPTIONS_DIALOG = 0;
    [...]
    createDialog(OPTIONS_DIALOG);
    [...]
    removeDialog(OPTIONS_DIALOG);
    

    as you can have only one dialog per activity, this will remove only this dialog and every(!) reference to it. Read http://developer.android.com/guide/topics/ui/dialogs.html to fully understand what is going on here.

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

Sidebar

Related Questions

I have an extended dialog class that I want to show for 3 seconds
I have to open a page from class extended from javax.swing.AbstractAction class... Is that
My question may be a bit unclear, but I have extended the View class
I have extended the android View class, and now I want to define a
I have a class extended from CCSprite that implements CCTargetedTouchDeledate like so: @interface PianoKey
I have extended a class that is part of a large library. I instantiate
I have extended PHP's mysqli class, which works fine. But how can I make
If I have a base class that contains a static var, I then set
In my program I have a class GraphDisplay extended from JPanel that is used
I have an extended from BaseAdapter class which used as a custom Adapter for

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.