Android:a demo for SQL
public class SQLhelper extends SQLiteOpenHelper { public static final String DB_NAME="DB_test"; public static final String TABLE_NAME_STRING="ApkInfo"; public static final String APK_ID="apkid"; public static final String PACKAGE_NAME="packname"; public static final String APP_NAME="appname"; public static final String IS_APP_GAME="isgame"; public static final String IS_APP_CHECKED="ischecked"; public SQLhelper(Context context, String name, CursorFactory factory, int version) { super(context, name, factory, version); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("create table if not exists " +TABLE_NAME_STRING+"("+APK_ID+" int primary key," +PACKAGE_NAME+" varchar(50)," +APP_NAME+" varchar(50)," +IS_APP_GAME+" int," +IS_APP_CHECKED+" int)" ); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("drop table if exists "+TABLE_NAME_STRING); onCreate(db); } /** * Add a apk into database * @param apkInfo app's information * @return true if success, else return false; */ public boolean InsertApkInfo(ApkInfo apkInfo) { SQLiteDatabase db =getWritableDatabase(); //db.beginTransaction(); ContentValues values=new ContentValues(); values.put(APK_ID, apkInfo.apkId); values.put(PACKAGE_NAME, apkInfo.packageName); values.put(APP_NAME, apkInfo.appName); values.put(IS_APP_GAME, 0); values.put(IS_APP_CHECKED, 0); try { db.insertOrThrow(TABLE_NAME_STRING, null, values); return true; } catch (Exception e) { return false; }finally{ db.close(); } }}
You must Sign up as a member of Effecthub to view the content.
ChOw
2013-10-23
A PHP Error was encountered
Severity: Notice
Message: Undefined index: HTTP_ACCEPT_LANGUAGE
Filename: helpers/time_helper.php
Line Number: 22
Latest Posts
- Android: CookieManager removeAllCookie() Crash
- XlistView: A listview which can pull to refresh and load more (1)
- Millions of Android Phones Could Be Affected by the Heartbleed Bug. Check to See if Yours Is One of Them
- TOP 10 ANDROID GAMES FOR MARCH 2014
- Android:Button with different textcolor and background in different states
1707 views 1 comments
You must Sign up as a member of Effecthub to join the conversation.