title: on selected method array-adapter
body: <p>I made <code>onItemSelected</code> method for a <code>Spinner</code> try to change a <code>TextView</code> which depends on the input of the <code>Spinner</code>. The problem is I get stuck with the first input and it's not changing once I chose different input.</p>
  
  <p>Here is the method and the onselectmethod  in the MainActivity</p>
  
  <pre><code>public void listView(int index){
  
      int indexs=0;
      Cursor res= db.getMainData();
      if(res.moveToFirst()){
          PPLNAMERES.setText(res.getString(indexs));
      } else{
          Toast.makeText(MainActivity.this,"No Data",Toast.LENGTH_LONG).show();
          return;
      }
  }
  
  @Override
  public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {
      PPLNAMERES = (TextView)findViewById(R.id.PPLNAMEGETNAME);
      listView(position);
  }
  </code></pre>
  
  <p>getMainData method in the sqliteopenhelper class </p>
  
  <pre><code>   public Cursor getMainData() {
      SQLiteDatabase db = this.getWritableDatabase();
      Cursor result = db.rawQuery("select NAMEPPL from " + Table_name2, null);
      return result;
  
       }
  </code></pre>