mercredi 2 septembre 2015

send variable from activity to sqlitehelper

I need to pass the string countryselect from this class

    public class MainActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {


public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

                String countryselect = countrydd.getSelectedItem().toString(); 

to this sql query in the sqlitehelper class

  public class DatabaseHandler extends SQLiteOpenHelper {

 public List<Contact> getAllnumbers() {

        List<Contact> contactListnumbers = new ArrayList<Contact>();


        String selectQuery = "SELECT  * FROM contacts WHERE name = '" + countryselect + "'";

Aucun commentaire:

Enregistrer un commentaire