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 android-developers@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to