Click here to Skip to main content
13,045,657 members (54,431 online)
Rate this:
Please Sign up or sign in to vote.
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
Updated 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2017
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