android 加密数据库

我们需要使用第三方的库 sqlcipher

import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteDatabase.CursorFactory;
import net.sqlcipher.database.SQLiteOpenHelper;


public class mySqlite extends SQLiteOpenHelper{
	
	public mySqlite(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase arg0) {
		

	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {

	}
}
SQLiteDatabase.loadLibs(mContext);
mySqlite mSqlite = new mySqlite(mContext, AppInfo.getAppInfo().getSqlitePath(), null, 1);
db = mSqlite.getWritableDatabase("123"); //password

 
  
 
  

 
  

你可能感兴趣的:(android)