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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:09:58+00:00 2026-05-24T17:09:58+00:00

So basically I’m using a TabGroupActivity inside my TabHost,so I can switch different activities

  • 0

So basically I’m using a TabGroupActivity inside my TabHost,so I can switch different activities inside of one tab.Two days before the code that I’m running right now was ok,without any exceptions.But in that time I was flipping views inside the tab.Now I change all views with different activities.So my situation is something like that:

Main tab Activity -> opens Second activity -> which opens the third activity ,where the AlertDialog is.

The code I’m using is that :

Button deactivate = (Button) findViewById(R.id.deactivate);
        deactivate.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                new AlertDialog.Builder( getParent() )
                .setTitle( "Warning" )
                .setMessage( "The collection will be removed completely from the device.You can reactivate it later again.This operation requires internet connection." )
                .setPositiveButton( "Go ahead", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        Log.d("AlertDialog", "Positive");
                    }
                })
                .setNegativeButton( "Cancel", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        Log.d("AlertDialog","Negative");
                    }
                })
                .show();    

            }

    });

and the Exception is :

08-14 11:08:33.254: ERROR/AndroidRuntime(4726): FATAL EXCEPTION: main
08-14 11:08:33.254: ERROR/AndroidRuntime(4726): android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@463430d0 is not valid; is your activity running?
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.view.ViewRoot.setView(ViewRoot.java:509)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.view.Window$LocalWindowManager.addView(Window.java:424)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.app.Dialog.show(Dialog.java:241)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.app.AlertDialog$Builder.show(AlertDialog.java:802)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at com.stampii.stampii.mystampii.MyCollectionId$4.onClick(MyCollectionId.java:74)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.view.View.performClick(View.java:2408)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.view.View$PerformClick.run(View.java:8817)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.os.Handler.handleCallback(Handler.java:587)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.os.Looper.loop(Looper.java:144)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at android.app.ActivityThread.main(ActivityThread.java:4937)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at java.lang.reflect.Method.invokeNative(Native Method)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at java.lang.reflect.Method.invoke(Method.java:521)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-14 11:08:33.254: ERROR/AndroidRuntime(4726):     at dalvik.system.NativeStart.main(Native Method)

I tried with this, MyCollecionId.this, with adding Context ad etc.but I can’t get the things to work.Any ideas how to solve that problem?

  • 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-24T17:09:59+00:00Added an answer on May 24, 2026 at 5:09 pm
    Button deactivate = (Button) findViewById(R.id.deactivate);
            deactivate.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    new AlertDialog.Builder( yourActivity.this )
                    .setTitle( "Warning" )
                    .setMessage( "The collection will be removed completely from the device.You can reactivate it later again.This operation requires internet connection." )
                    .setPositiveButton( "Go ahead", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            Log.d("AlertDialog", "Positive");
                        }
                    })
                    .setNegativeButton( "Cancel", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            Log.d("AlertDialog","Negative");
                        }
                    })
                    .show();    
    
                }
    
        });
    

    try it out, pass your running activity’s context

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

Sidebar

Related Questions

Basically, I'm optimizing a website for the different versions of IE. I'm using IE9
Basically, I would like a brief explanation of how I can access a SQL
Basically I want to know how to set center alignment for a cell using
Basically, i wanted to return only one row and one column of result from
Basically, I need to adjust the font type everywhere it isn't specified. How can
Basically I have two models: User and Godfather. The godfather table has three columns:
Basically, I'm using python to print out some information in the terminal and some
Basically, I have a user input field where a user can enter a number.
Basically I am writing a simple program using the boost socket library... I have
Basically what I want to do it this: a pdb file contains a location

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.