package com.util;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class SQLiteHelp extends SQLiteOpenHelper {
public final static int VERSION = 1;// 版本号
public SQLiteHelp(Context context) {
super(context, "login.db", null, VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
try {
db.execSQL("create table IF NOT EXISTS user (id INTEGER PRIMARY KEY AUTOINCREMENT,Name String,Password String)");
} catch (SQLException ex) {
Log.i("sqlliteHelp", "数据库创建失败");
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
try {
db.execSQL("drop table if exists user");
this.onCreate(db);
} catch (SQLException ex) {
Log.i("sqlliteHelp", "");
}
}
/**
* 用于执行增删改操作
*
* @param sql
* 以insert,update,delete打头的sql语句
*/
public void ExecuteSQL(String sql) {
SQLiteDatabase db = this.getWritableDatabase();
try {
Log.i("sqlliteHelp", sql);
db.execSQL(sql);
} catch (SQLException ex) {
throw ex;
} finally {
db.close();
}
}
/**
* 用于完成数据的查询操作
*
* @param sql
* 以Select打头的SQL语句
* @return Cursor
* @throws SQLException
*/
public Cursor SELECTUser(String condition) throws SQLException {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = null;
cursor = db.query("user", new String[] { "id", "name", "password" },
condition, null, null, null, null);
return cursor;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
两个apk之间广播互相通信及ContentProvider监听数据库的变换
共62个文件
class:19个
png:12个
java:9个
5星 · 超过95%的资源 需积分: 41 122 下载量 17 浏览量
2012-03-09
14:34:51
上传
评论 5
收藏 133KB ZIP 举报
温馨提示
两个apk之间通过Broadcast,BroadcastReceiver广播互相通信及ContentProvider监听数据库增删改查的变换
资源推荐
资源详情
资源评论
收起资源包目录
两个apk之间广播互相通信及ContentProvider监听数据库的变换.zip (62个子文件)
两个apk之间广播互相通信及ContentProvider监听数据库的变换
HelloWorld
AndroidManifest.xml 1002B
res
layout
ok.xml 466B
main.xml 1KB
drawable-ldpi
icon.png 2KB
drawable-mdpi
icon.png 3KB
drawable-hdpi
icon.png 4KB
values
strings.xml 179B
proguard.cfg 1KB
src
com
ktouch
HelloWorld2
OkAcitivity.java 296B
MyBroadcastReceiver.java 1KB
helloWorldActivity.java 1KB
bin
classes
com
ktouch
HelloWorld2
helloWorldActivity.class 2KB
R.class 559B
helloWorldActivity$1.class 1KB
R$layout.class 432B
R$attr.class 352B
R$id.class 522B
R$string.class 439B
R$drawable.class 412B
MyBroadcastReceiver.class 1KB
OkAcitivity.class 522B
res
drawable-ldpi
icon.png 2KB
drawable-mdpi
icon.png 2KB
drawable-hdpi
icon.png 4KB
classes.dex 5KB
HelloWorld.apk 16KB
resources.ap_ 12KB
.classpath 288B
assets
project.properties 360B
.project 846B
gen
com
ktouch
HelloWorld2
R.java 1001B
HelloWorld2
AndroidManifest.xml 1KB
res
layout
main.xml 382B
drawable-ldpi
icon.png 2KB
drawable-mdpi
icon.png 3KB
drawable-hdpi
icon.png 4KB
values
strings.xml 167B
proguard.cfg 1KB
src
com
util
SQLiteHelp.java 2KB
HelloWorld
MyContentProvider.java 1KB
MyBroadcast.java 1KB
Hello.java 424B
bin
classes
com
util
SQLiteHelp.class 2KB
HelloWorld
R.class 465B
MyBroadcast.class 2KB
R$layout.class 382B
R$attr.class 328B
MyContentProvider.class 2KB
Hello.class 616B
R$string.class 415B
R$drawable.class 388B
res
drawable-ldpi
icon.png 2KB
drawable-mdpi
icon.png 2KB
drawable-hdpi
icon.png 4KB
classes.dex 6KB
resources.ap_ 11KB
HelloWorld2.apk 16KB
.classpath 288B
assets
project.properties 360B
.settings
org.eclipse.jdt.core.prefs 208B
.project 847B
gen
com
HelloWorld
R.java 636B
共 62 条
- 1
jjsyjiao
- 粉丝: 72
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页