Results 1 to 2 of 2
  1. #1
    insectincest is offline Member
    Join Date
    Apr 2010
    Posts
    1
    Rep Power
    0

    Default Syntax in eclipse

    I have no idea where to put this, I've been posting on the android dev forums, but, to no avail .... This is a java specific issue, im using eclipse, there are no posts in android section, so I figured, I'de give it a whirl in here ... sorry if its in the wrong place ... anwhoooo .....

    Im getting Syntax error on token "}", { expected When I try to compile this code .... I'm sure there is more wrong with it, but this is the point I'm at right now .....

    There is 2 spinners(android dropdown boxes), spinner2 populates from spinner1 selection.

    Java Code:
    public class fudge6 extends Activity 
    {
        protected static final int LENGTH_LONG = 20;
    	/** Called when the activity is first created. */
    	private Button SearchButton;
    	
    
        @Override
        public void onCreate(final Bundle savedInstanceState) 
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            
                  Spinner spinnerMake = (Spinner) findViewById(R.id.spinnerMake);
                  ArrayAdapter<CharSequence> adaptermake = ArrayAdapter.createFromResource(
                          this, R.array.make_array, android.R.layout.simple_spinner_item);
                  adaptermake.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                  spinnerMake.setAdapter(adaptermake);
        }
                  
                  
                  private OnItemSelectedListener selectListener = new OnItemSelectedListener()
                  {
                                  public void onItemSelected(AdapterView parent, View v, int position, long id) 
                                  {
                                       spinnerMake.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
                                       {
                                    	   
                                       });
                                       
                                	  // here right now... need switch statement
                                	  switch(spinnerMake.getOnItemSelectedListener())
                                	  {
                                	  
                                	  	case 0:
                                	  	{
                                	  		// 1st car manufacturer spinner loader for MODEL
                                	  		Spinner spinnerModel = (Spinner) findViewById(R.id.spinnerModel);
                                	  		ArrayAdapter<CharSequence> adaptermodel = ArrayAdapter.createFromResource(
                                				  this, R.array.acura_models, android.R.layout.simple_spinner_item);
                                	  		adaptermodel.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                                	  		spinnerModel.setAdapter(adaptermodel);
                                	  		break;
                                	  	}
                                	  	case 1:
                                	  	{
                                	  		// 2nd car manufacturer
                                	  		Spinner spinnerModel = (Spinner) findViewById(R.id.spinnerModel);
                                	  		ArrayAdapter<CharSequence> adaptermodel = ArrayAdapter.createFromResource(
                                				  this, R.array.audi_models, android.R.layout.simple_spinner_item);
                                	  		adaptermodel.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                                	  		spinnerModel.setAdapter(adaptermodel);
                                	  		break;
                                	  	}
                                	  
                                	  }
                                	  
                                	  
                                  
                                  }                 
                  } // Syntax error on token "}", { expected
                                  
      
    
                                  
            this.SearchButton = (Button)this.findViewById(R.id.SearchButton);
            this.SearchButton.setOnClickListener(new OnClickListener() 
            {
              @Override
              public void onClick(View v) 
              {
                //finish();
            	  // .setVisibility(View.GONE);
            	  Toast.makeText(fudge6.this,"Searching ... ", Toast.LENGTH_SHORT/LENGTH_LONG).show();
            	  //Intent myIntent = new Intent(v.getContext(), Activity2.class);
                  //startActivityForResult(myIntent, 0);
             
              }
    
            
            }); // ends setOnClickListener from this.SearchButton
    
    					
    };
    
    					
    };
    }


    There she is .. the error is labeled with comment to be an error...

    Any help would be greatly appreciated! thank you in advance! :)

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    It could be the missing ';' that should be at the end of that line, I think.

    Then again, you have code that isn't inside a method after that.

Similar Threads

  1. A question about syntax.
    By mr_o in forum New To Java
    Replies: 2
    Last Post: 09-19-2009, 09:30 PM
  2. Eclipse Syntax Highlighting
    By garrettgjb in forum Eclipse
    Replies: 1
    Last Post: 08-24-2009, 04:10 PM
  3. Syntax Colouring
    By Doctor Cactus in forum New To Java
    Replies: 2
    Last Post: 02-16-2009, 05:46 PM
  4. [SOLVED] Looking for web.xml syntax doc
    By Norm in forum Java Servlet
    Replies: 2
    Last Post: 08-21-2008, 08:59 PM
  5. syntax error
    By gabriel in forum New To Java
    Replies: 3
    Last Post: 08-03-2007, 04:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •