Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.ContentValues;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    private static final String TABLE_NAME = "Item";
    private static final String COLUMN_STATE = "state";

    public static int updateItemsFromStateToState(SQLiteDatabase database, Integer original_state,
            Integer new_state) {
        String where_clause = COLUMN_STATE + " = " + original_state;
        ContentValues values = new ContentValues();
        values.put(COLUMN_STATE, new_state);

        int affected = database.update(TABLE_NAME, values, where_clause, null);

        return affected;
    }
}