In android, how can get I get a value (that is of type integer) from EditText and insert it into database that has a integer field?
I am using the below code but it doesn’t save integer data into database!
EditText Price;
name = (EditText)findViewById(R.id.txt_GoodsName);
Price = (EditText)findViewById(R.id.txt_Price);
db.insertQuote(name.getText().toString(),Price.getText());
// ----------------------------------------------------------
public long insertQuote(String Quote,int Price1)
{
ContentValues initialValues = new ContentValues();
initialValues.put(GoodName, Quote);
initialValues.put(Price, Price1);
return db.insert(DATABASE_TABLE, null, initialValues);
}
use
or
instead of
because
db.insertQuote(String,Integer)accept second parameter as Integer not as String.