I'm working on an application where I've 2 Multiline EditText and I need to store them into database. i only know how to store the single line EditText.
Here is my codes for inserting into database:
btnSave = (Button) findViewById(R.id.btnSave);
btnSave.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
//startActivityForResult(new Intent(Intent.ACTION_PICK),PICK_CONTACT);
likeDB.open();
long likes_id;
Spinner nameSpinner = (Spinner) findViewById(R.id.nameSpinner);
String NameValue = nameSpinner.getSelectedItem().toString();
EditText txtLikes = (EditText) findViewById(R.id.txtLikes);
String LikesValue = txtLikes.getText().toString();
likes_id = likeDB.insertLikes(NameValue, LikesValue);
likeDB.close();
dislikeDB.open();
long dislikes_id;
Spinner names = (Spinner) findViewById(R.id.nameSpinner);
String NamesValue = names.getSelectedItem().toString();
EditText txtDislikes = (EditText) findViewById(R.id.txtDislikes);
String DislikesValue = txtDislikes.getText().toString();
dislikes_id = dislikeDB.insertDislikes(NamesValue, DislikesValue);
Toast.makeText(getBaseContext(),
"Your information is saved successfully!", Toast.LENGTH_SHORT).show();
dislikeDB.close();
}
});
This the code where I've declared the LikeDBAdapter and DislikesDBAdapter above the onCreate() method:
LikesDBAdapter likeDB = new LikesDBAdapter(this);
DislikesDBAdapter dislikeDB = new DislikesDBAdapter(this);
I need help with this. Any help will be appreciated. Thanks!
=)