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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:39:47+00:00 2026-05-23T22:39:47+00:00

I am making an application and i am facing a problem. I am using

  • 0

I am making an application and i am facing a problem.

I am using Tab bars and in one of my Tab bar i am using Spinner.

It loads Perfectly but when i click on it. it gives me:

android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@44647ef8 is not valid; is your activity running?

This error.

i am using the following code snippet

      ArrayList<String> ageList;
        Spinner age;
        age = (Spinner) findViewById(R.id.country);

        ageList = new ArrayList<String>();
        ageList.add("10-20");
        ageList.add("21-35");
        ageList.add("36-60");
        ageList.add("61-100");
        ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this,
                android.R.layout.simple_spinner_item, ageList);  //array you are populating  
        adapter2.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
        age.setAdapter(adapter2);
        age.setSelection(0, true);

This code work fine when i am using seperate activity not the tab bars. but in tab bars it gives me the above error exception when i click on the spinner to open a list.

Please guide me Thanks a bunch

  • 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-23T22:39:47+00:00Added an answer on May 23, 2026 at 10:39 pm

    I m done with this
    the problem was with my layout

    setContentView(R.layout.age)
    

    Instead of this i used Layout Inflator as below:

     View viewToLoad = LayoutInflater.from(this.getParent()).inflate(R.layout.country, null);
            this.setContentView(viewToLoad);
    

    and then called the Spinner n Bingooo! It works Just Perfect

    Thanks all of you.. 🙂

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

Sidebar

Related Questions

I'm making an application in which there are few tabs on each tab click
I am using LinkedIn-j api for making a Linkedin application.The problem that I am
I am making an application with Java Swing and i have a problem. I
I am facing a problem while making Excel's LinEST function. My program goes like
The specific problem I’m facing is with a buggy Flash application that I don’t
I am making a application in which i go from one view to another
We are making an application that needs to convert one file format to another.
I'm making something that writes data to a file. Now the problem I'm facing
in my web application i am facing a issue after making it live. i
I am making application with OpenGL in IOS using PVR texture for making 3D

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.