Have you tried using Log to print out the values you are using in your
SQL queries? I bet something there is null. Do you have the stack
trace to tell you what line in the code is causing the problem?
On Apr 7, 6:24 pm, Sawan007 <[EMAIL PROTECTED]> wrote:
> Could you please advise what is wrong with this piece of code. After
> clikcing on button "Change Password" (confirmButton). I get the
> Application error
> An error has occurred in ... near "null":syntax error.
> Please help.
>
> public class password extends Activity
> {
> private SQLiteDatabase db;
> private EditText pwd1;
> private EditText pwd2;
> private int passset = 1;
> /** Called when the activity is first created. */
>
> class Row extends Object {
> public String password;
> public long rowId;
> }
>
> public void onCreate(Bundle icicle) {
> super.onCreate(icicle);
> setContentView(R.layout.pass_change);
>
> if(passset == 1){
> // ask for pass
> Intent i = new Intent(this, passverify.class);
> startSubActivity(i, 0);
>
> pwd1 = (EditText) findViewById(R.id.pass1);
> pwd2 = (EditText) findViewById(R.id.pass2);
>
> Button confirmButton = (Button)
> findViewById(R.id.pass_change);
> Button cancelButton = (Button) findViewById(R.id.cancel);
> // populateFields();
>
> confirmButton.setOnClickListener(new
> View.OnClickListener() {
>
> public void onClick(View arg0) {
> String password1 = pwd1.getText().toString();
> String password2 = pwd2.getText().toString();
> if (password1.equals(password2)){
> try {
> db = openDatabase("sms", null);
> }
> catch (FileNotFoundException e1) {
> db = null;
> }
> db.execSQL("create table password (rowid integer
> primary
> key autoincrement,"
> + "password text not null");
> Row row = new Row();
> Cursor c =
> db.query(true, "password", new String[] {
> "rowid", "password"}, null, null, null,
> null, null);
> if (c.count() > 0) {
> c.first();
> row.rowId = c.getLong(0);
> row.password = c.getString(1);
> c.close();
> ContentValues args = new ContentValues();
> args.put("password", password1);
> db.update("password", args, "rowid=" +
> row.rowId, null);
> } else {
> //row.rowId = -1;
> //row.password = null;
> c.close();
> /*ContentValues initialValues = new
> ContentValues();
> initialValues.put("password", password1);
> db.insert("password", null, initialValues);
> */
> db.execSQL("insert into password
> values('"+password1+"')");
> }
> }
> //db.close();
> setResult(RESULT_OK);
> finish();
> }
> }
> );
> cancelButton.setOnClickListener(new View.OnClickListener() {
>
> public void onClick(View arg0) {
> setResult(RESULT_OK);
> finish();
> }
> }
> );
> }
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---