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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:03:26+00:00 2026-05-23T10:03:26+00:00

When the viewer selects an item from the spinner it should start a new

  • 0

When the viewer selects an item from the spinner it should start a new intent.

BUT the app automaticly goes to the intent without waiting for the select. I thought the onNothingSelected was supposed to hold the app on the current activity until the user makes a selection. How do I fix this issue?

areaspinner.setOnItemSelectedListener(new OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> arg0, View arg1,
                int arg2, long arg3) {
            int item = areaspinner.getSelectedItemPosition();

                Bundle bundle = new Bundle();
                bundle.putInt("selection", item);

                   Intent myIntent = new Intent(patriosar.this, ShowXMLPAR.class);
                   myIntent.putExtras(bundle);
                   startActivityForResult(myIntent, 0);




        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
  • 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-23T10:03:26+00:00Added an answer on May 23, 2026 at 10:03 am

    Try doing this

    private boolean mFirstSelect = true; //make this a field
    
    areaspinner.setOnItemSelectedListener(new OnItemSelectedListener() {
    
            public void onItemSelected(AdapterView<?> arg0, View arg1,
                    int arg2, long arg3) {
                if (mFirstSelect)
                {
                      mFirstSelect = false;
                      return;
                }
                int item = areaspinner.getSelectedItemPosition();
    
                    Bundle bundle = new Bundle();
                    bundle.putInt("selection", item);
    
                       Intent myIntent = new Intent(patriosar.this, ShowXMLPAR.class);
                       myIntent.putExtras(bundle);
                       startActivityForResult(myIntent, 0);
    
    
    
    
            }
    
            public void onNothingSelected(AdapterView<?> parent) {
            }
    

    Your select listener is getting fired when you set the values. This will prevent that from happening

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

Sidebar

Related Questions

We have a 3D viewer that uses OpenGL, but our clients sometimes complain about
Is there a log viewer for displaying Ruby log files from any of its
Initially i added full source code for viewer. but it has some format problem
We have an UI where user selects a department. It goes into a List
In my application the user selects an image. When the ACTION_GET_CONTENT intent is launched
Hey i want to create a thumbnail viewer, for my app, i want something
So I've built this mail-program-like HTML viewer (no real emails, just some messages from
My application is a viewer for a custom format, a zip file with a
I have a page viewer as main window showing an external page as we
When using the Event Viewer in Windows 7, there is a separate 'XML View'

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.