Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two java class files namely a. listmasteritems b. Mydbhandler.
In an activity I use an edittext and a button. On button click in the device, I intend to send the text to the database. I get an error on button click (in device) stating
'Unfortunately,tommy has stopped working' when I include the line

Hereunder is my code:

public void onBtnIncludeClick( View v)
        listmasteritems name=new listmasteritems(editText.getText().toString());


In Mydbhandler:

//add new row to the database
public void addNewAccountName(listmasteritems name)
ContentValues values= new ContentValues();
SQLiteDatabase db=getWritableDatabase();
Updated 6-Mar-15 23:00pm

1 solution

There are many possible reasons why this caused an error.

  1. Connection not established
  2. Error in value

.. and so on. The actual problem is in your Console; or for Android development in Logcat. You should see for why the exception got raised. Then, solve that exception's cause.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900