title: Android - Passing a variables to another activity
body: <p>I want to pass a Variable to my DBConnector.Java where I am executing an SQLite query but I am not sure how to do that and need some help.</p>
  
  <pre><code>public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position,long id) 
      {
                  spinnerRub.setSelection(position);      
              myRub = (String) spinnerRub.getSelectedItem();
  
      }
  </code></pre>
  
  <p>Now I want to pass myRub to my DBConnector.Java where I have:</p>
  
  <pre><code>public List&lt;String&gt; getAllCapabilities1()
  {             
  
  List&lt;String&gt; Caps = new ArrayList&lt;String&gt;();
  
                  String selectQuery = "SELECT Cap_Name FROM capability where Rub_ID = 'myRub'";
  
              SQLiteDatabase database = this.dbOpenHelper.getReadableDatabase();
              //Cursor cursor = database.rawQuery(selectQuery, null);
              Cursor cursor = database.rawQuery(selectQuery, null);
              // looping through all rows and adding to list
              if (cursor.moveToFirst()) 
              {
                  do 
                  {
                    Caps.add(cursor.getString(0));
                  } while (cursor.moveToNext());
              }
  
              // closing connection
              cursor.close();
              database.close();
  
              // returning lables
              return Caps;
          }   
  </code></pre>
  
  <p>But I am struggling to do that and need help.</p>