Children how to transfer variable value in Sqlite.

Here is the code for creating columns in the code, and my unsuccessful attempt to insert values ​​from text fields.

EditText Name2 = (EditText) findViewById(R.id.editText1); EditText Number2 = (EditText) findViewById(R.id.editText2); Name2.getText().toString(); Number2.getText().toString(); SQLiteDatabase db = openOrCreateDatabase("Rielt",MODE_PRIVATE,null); db.execSQL("CREATE TABLE IF NOT EXISTS ONE("+Name+" VARCHAR,"+Number+" Int);"); db.execSQL("INSERT INTO ONE VALUES('"+ Name2 +",' "+ Number2 +");"); db.close(); 

    1 answer 1

    First you need to at least select the code. And secondly, a little bit to rest on the development under the android.
    I understood approximately what you need, but not the fact that it will work

      EditText Name2 = (EditText) findViewById(R.id.editText1); EditText Number2 = (EditText) findViewById(R.id.editText2); String name_1 = "name1";//тут посылаете ваше значение Sting number_1 = "123";//тут посылаете чило, которое вам надо String name_2 = Name2.getText().toString(); String number_2 = Number2.getText().toString(); SQLiteDatabase db = openOrCreateDatabase("Rielt",MODE_PRIVATE,null); db.execSQL("CREATE TABLE IF NOT EXISTS ONE("+name_1+" VARCHAR,"+number_1+" Int);"); db.execSQL("INSERT INTO ONE VALUES('"+ name_2 +",' "+ number_2 +");"); db.close();