title: Spinner, ArrayAdapter
body: <p>I have a problem with the Spinner. I have set the ArrayAdapter and set OnItemSelected Listener. but in the onClick method it shows an error in the els-if statement an error.</p>
  
  <pre><code>// Create an ArrayAdapter using the string array and a default spinner layout
          ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(this,
                  R.array.category_array, android.R.layout.simple_spinner_item);
          // Specify the layout to use when the list of choices appears
          adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          // Apply the adapter to the spinner
          categorySpinner = (Spinner) findViewById(R.id.editCategorySpinner);
  
          categorySpinner.setAdapter(adapter);
          categorySpinner.setOnItemSelectedListener(this);
  
  }
  
  private void configureButton2() {
          Button save = (Button) findViewById(R.id.btSave);
  
          save.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  if (textName.getText().length() == 0) {
                      textName.requestFocus();
                      return;
                  } else if (textContent.getText().length() == 0) {
                      textContent.requestFocus();
                      return;
                  } else if (categorySpinner.**getText**().length() == 0) {
                      CategorySpinner.requestFocus();
                      return;
                  } else {
                      //next Step: get the mood
                      Intent myIntent = new Intent(v.getContext(), Activity2.class);
                  myIntent.putExtra("textName", textName.getText().toString());
                  myIntent.putExtra("textContent", textContent.**getText**().toString());
                  myIntent.putExtra("CategorySpinner", CategorySpinner.**getText()**.toString());
                  v.getContext().startActivity(myIntent);
              }
                  }
              }
          });
          }
  
  @Override
      public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos,long id) {
  
          String selected = parent.getItemAtPosition(pos).toString();
  
      }
  
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
          // TODO Auto-generated method stub
  
      }
  </code></pre>
  
  <p>I tried this in the else-if statement:</p>
  
  <pre><code>} else if (((CharSequence) docuCategory.getTag()).length() == 0) {
                  docuCategory.requestFocus();
                  return;
  </code></pre>
  
  <p>this dose not show any error but the emulator "unfortunately stopped"</p>
  
  <p>Hope you can help me.</p>