Created
September 14, 2012 11:08
-
-
Save Matsushige/3721334 to your computer and use it in GitHub Desktop.
CSVファイルダウンロード<データベース作成クラス>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.ContentValues; | |
import android.content.Context; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteOpenHelper; | |
public class Database extends SQLiteOpenHelper{ | |
public Database(Context context){ | |
super(context,"usersData.sqlite", null, 1); | |
} | |
@Override | |
public void onCreate(SQLiteDatabase db) { | |
// TODO Auto-generated method stub | |
db.execSQL("CREATE TABLE users(" | |
+"_id TEXT, type TEXT, id TEXT, name TEXT," | |
+" code TEXT, time TEXT);"); | |
ContentValues cv = new ContentValues(); | |
cv.put("_id", "#"); | |
cv.put("type","ic_type"); | |
cv.put("id", "ic_id"); | |
cv.put("name", "user_name"); | |
cv.put("code", "code"); | |
cv.put("time", "time"); | |
// cv.put("level", 1); | |
db.insert("users", null, cv); | |
} | |
@Override | |
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { | |
// TODO Auto-generated method stub | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment