Click here to Skip to main content
11,796,631 members (73,161 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: XML Java Android
hi all..
i m very new to android development...i have created one app which works well for inserting into and selecting data from database...
but i don't know how to update data in database...
here is code i have tried...but get NullPointerException...

if (v.getId()
            Cursor value = null ;

            String name=value.getString(value.getColumnIndex("name"));
             String pass=etpass.getText().toString();
             String uname=etuname.getText().toString();
            long update=dbAdaptert.updateTest(name, uname, pass);
                Toast.makeText(getApplicationContext(), "Data updated",Toast.LENGTH_LONG).show();
                Toast.makeText(getApplicationContext(), "Data not updated",Toast.LENGTH_LONG).show();

Posted 21-Feb-13 22:30pm
Edited 22-Feb-13 3:25am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

there is a update command for that:

android.database.sqlite.SQLiteDatabase. update (String table, ContentValues values, String whereClause, String[] whereArgs)[^]

please also take a look at the great tutorial by Lars Vogel upon working with SQlite in Android:[^]

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

  Print Answers RSS
0 Maciej Los 505
1 Abhinav S 417
2 OriginalGriff 360
3 CPallini 285
4 KrunalRohit 249
0 OriginalGriff 2,012
1 Maciej Los 1,725
2 KrunalRohit 1,310
3 CPallini 1,055
4 ppolymorphe 858

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100