Search Results

Search found 1 results on 1 pages for 'sajan'.

Page 1/1 | 1 

  • How to update a row in Android database

    - by Sajan
    Hi all I want to update a row on clicking on update button,but its doesn't work. I have used following code. public void btnUpdate(View v) { handeler.updateData(updateName.getText().toString(), updatePhone .getText().toString(), updateEmail.getText().toString(),id); } public void updateData(String name, String phone, String email, String id) { ContentValues values = new ContentValues(); values.put(COLUMN_FIRST, name); values.put(COLUMN_SECOND, phone); values.put(COLUMN_THIRD, email); database.update(TABLE_NAME, values, id, null); } public void search() { Cursor cursor = handeler.getData(); if (cursor.moveToFirst()) { String phoneNo; phoneNo = updateByPhone.getText().toString(); do { String s1 = cursor.getString(2); if (phoneNo.compareTo(s1) == 0) { id = cursor.getString(0); updateName.setText(cursor.getString(1)); updateEmail.setText(cursor.getString(3)); updatePhone.setText(cursor.getString(2)); } } while (cursor.moveToNext()); } } So if any know please suggest me how to solve it. Thanks

    Read the article

1