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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:28:29+00:00 2026-06-04T07:28:29+00:00

I have an Activity which has an ‘OK’ button. And I have an ‘Edit’

  • 0

I have an Activity which has an ‘OK’ button. And I have an ‘Edit’ button which will open a Dialog (theme="@android:style/Theme.Holo.Light.Dialog"). When I am in the EditDialog, I can see the OK button in the background Activity, and I can press that, and it the press is getting registered.

Is there a way to disable the background Activity actions when a Dialog is open? i.e. I want to modify things in the Dialog alone.

Edit: Adding a sample code which shows this behaviour.
Main Activity:

public class DialogTestActivity extends Activity implements OnClickListener {
    private final String TAG = "DialogTest.main";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        ((Button) findViewById(R.id.button_open)).setOnClickListener(this);
        ((Button) findViewById(R.id.button_ok)).setOnClickListener(this);
    }

    public void onClick(View v) {
        switch (v.getId()) {
        case R.id.button_ok:
            Log.w(TAG, "OK Button Pressed!");
            break;
        case R.id.button_open:
            Log.d(TAG, "Opening new Window.");
            Intent intent = new Intent(this, TestDialog.class);
            startActivity(intent);
        default:
            break;
        }
    }
}

TestDialog ‘dialog’:

public class TestDialog extends Activity {

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test_dialog);

        LayoutParams params = getWindow().getAttributes();
        params.height = LayoutParams.WRAP_CONTENT;

        Window window = this.getWindow();
        window.setAttributes((android.view.WindowManager.LayoutParams) params);
        window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
                WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
    }
}

Manifest:

<activity
    android:name=".DialogTestActivity"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Holo.Light" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity
    android:name=".TestDialog"
    android:label="@string/dialog_label"
    android:theme="@android:style/Theme.Holo.Light.Dialog" >
</activity>

With the above code, when the TestDialog was open, the Button Press on the background Activity were registered – OK Button Pressed! will be logged.

  • 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-04T07:28:31+00:00Added an answer on June 4, 2026 at 7:28 am

    First, this is not a dialog. This is a dialog-themed activity. A dialog inherits from Dialog.

    Second, your use of WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL is giving you precisely the behavior that you do not want. Delete this line of code, and things should work better.

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

Sidebar

Related Questions

I have an Android activity we'll call A which has a button and another
Here's the scenario I have an activity(A) which has a button and textview. I
I have an Android activity which has a header, some title text, and then
I have an Activity A which has a "down" button (see image above). When
I have a launching Activity A1 which has a start button which starts a
I have an activity which has two edit text fields: one for the title
I have an Activity class which has an attribute that references an AsyncTask instance
I have a custom activity which has inargument<MyClass>. MyClass has several properties. I want
I have an Android activity which in turn starts a thread. In the thread
I have an activity which has a database query and it brings back 300

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.