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

  • Home
  • SEARCH
  • 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 7196809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:50:55+00:00 2026-05-28T20:50:55+00:00

I am using Tabwidget, Tab are implemented in same way which shows in tutorial

  • 0

I am using Tabwidget, Tab are implemented in same way which shows in tutorial

"MainActivity -> Activity1 -> Activity2(given Image)"

view for the current activity

Now clicking on the spinner gives

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

I have tried Android Spinner Error : android.view.WindowManager$BadTokenException: Unable to add window already but that doesn’t help me

I know There is something wrong with context but I can’t figure out what

Hear is my Intent which starts DetailActivity

intent = new Intent(getParent(), DetailActivity.class);
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
parentActivity.startChildActivity("SelectActivity", intent);

My code for the DetailActivity given bellow

@Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.package_detail);
        setUpViews();

        id = getIntent().getExtras().getInt("WEBSITE_ID");

        adapter = new KeywordAdapter(getApplicationContext(), id,
                getLNApplication().getKeyworddetail());
        listTags.setAdapter(adapter);

        spinneAdapter = new SpinnerListAdapter();
        spinnerList.setAdapter(spinneAdapter);
        spinnerList.setSelection(id, true);
        spinnerList
                .setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                    public void onItemSelected(AdapterView<?> parent,
                            View view, int position, long id) {

                        // txtHeader.setText(getLNApplication().getWebsiteList()
                        // .get(position).getName());
                        adapter.forceReload();
                        adapter = new KeywordAdapter(DetailActivity.this,
                                position, getLNApplication().getKeyworddetail());
                        listTags.setAdapter(adapter);
                    }

                    public void onNothingSelected(AdapterView<?> parent) {

                    }
                });

    }

code for SpinnerAdapter

public class SpinnerListAdapter extends BaseAdapter {

        private List<ClientDetail> siteList;

        public SpinnerListAdapter() {
            siteList = getLNApplication().getWebsiteList();
        }
        
        public void forceReload() {
            notifyDataSetChanged();
            
        }

        @Override
        public int getCount() {
            return siteList.size();
        }

        @Override
        public Object getItem(int position) {
            // TODO Auto-generated method stub
            return siteList.get(position);
        }

        @Override
        public long getItemId(int position) {
            return position;
        }
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View view = convertView;
            
//          LayoutInflater inflater = (LayoutInflater) context
//              .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    
//          LayoutInflater inflater = getLayoutInflater();
    
//          LayoutInflater inflater = LayoutInflater.from(DetailActivity.this.getParent());
    
            LayoutInflater inflater = LayoutInflater.from(DetailActivity.this.getParent());
                view = inflater.inflate(R.layout.spinner_item_display, null);
                TextView websiteName = (TextView) view.findViewById(R.id.spinnerItem);
            if (siteList.get(position).getName() != null) {
                websiteName.setText(siteList.get(position).getName());
                websiteName.setTextColor(0xFF000000);
            }
            return view;
        }

        @Override
        public View getDropDownView(int position, View convertView, ViewGroup parent) {
            View view = convertView;
            
//          LayoutInflater inflater = (LayoutInflater) context
//                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            
//          LayoutInflater inflater = getLayoutInflater();
            
//          LayoutInflater inflater = LayoutInflater.from(DetailActivity.this.getParent());
            
            LayoutInflater inflater = LayoutInflater.from(DetailActivity.this.getParent());
                view = inflater.inflate(R.layout.spinner_dropdown_display, null);
                TextView websiteName = (TextView) view.findViewById(R.id.spinnerDropDownItem);
            if (siteList.get(position).getName() != null) {
                websiteName.setText(siteList.get(position).getName());
                websiteName.setTextColor(0xFF000000);
            }
            return view;
        }
    }

Am i doing anything wrong?

please help me with… Thank you so much

  • 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-28T20:50:56+00:00Added an answer on May 28, 2026 at 8:50 pm

    pass

    YourActivty.this.getParent()
    

    as Context to the Spinner.

    For more information see here and here

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

Sidebar

Related Questions

When a TabWidget is using intents to designate the target Activity for each tab,
I am using tabwidget when i apply white theme on tab widget selected tab
Using online interfaces to a version control system is a nice way to have
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
I'm using a custom TabWidget to display my tabs. The tabs work wonderfully when
I am using the following code to setup a TabWidget: public void onCreate(Bundle savedInstanceState)
hi frnds i want to set tab host on the bottom of screen using
I have created a custom tabbar in my application (using TabHost and TabWidget ).
I'm using a dynamic jQuery tab widget to add/remove tabs generated programmatically. How do
I'd like to display image on top of div using absolute positioning within jQuery's

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.