Here you can find the source of updateTable(SQLiteDatabase database, String table, String id, String[] newValues)
public static void updateTable(SQLiteDatabase database, String table, String id, String[] newValues)
//package com.java2s; import android.content.ContentValues; import android.database.sqlite.SQLiteDatabase; public class Main { public final static String NESTLE_TABLE_NAME = "Nescafe"; public final static String NESTLE_PRIMARY_KEY = "_id"; public final static String NESTLE_COLUMN_1 = "date"; public final static String NESTLE_COLUMN_2 = "first"; public final static String NESTLE_COLUMN_3 = "last"; public final static String NESTLE_COLUMN_4 = "difference"; public final static String TIPS_TABLE_NAME = "Tips"; public static void updateTable(SQLiteDatabase database, String table, String id, String[] newValues) { ContentValues cv = new ContentValues(); if (table.equals(NESTLE_TABLE_NAME)) { try { cv.put(NESTLE_COLUMN_1, newValues[0]); } catch (ArrayIndexOutOfBoundsException e) { }/*from w w w . j a v a 2 s . com*/ try { cv.put(NESTLE_COLUMN_2, newValues[1]); } catch (ArrayIndexOutOfBoundsException e) { } try { cv.put(NESTLE_COLUMN_3, newValues[2]); } catch (ArrayIndexOutOfBoundsException e) { } try { cv.put(NESTLE_COLUMN_4, newValues[3]); } catch (ArrayIndexOutOfBoundsException e) { } database.update(table, cv, NESTLE_PRIMARY_KEY + " =" + quote(id), null); } else if (table.equals(TIPS_TABLE_NAME)) { } } public static String quote(String s) { return "\'" + s + "\'"; } }