2013.3.26 PendingIntent,sqlite数据库

前端之家收集整理的这篇文章主要介绍了2013.3.26 PendingIntent,sqlite数据库前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1,PendingIntent,当满足某些条件时要执行某个动作,动作包括激活一个Activity,broadcast,Service,具体动作和数据在Intent中,PendingIntent已知用在通知,短信发送,Alarm中,PendingIntent保存当前应用的context,即使当前应用被killed掉,其他应用也有权限和能力执行操作。

If the creating application later re-retrieves the same kind of PendingIntent (same operation,same Intent action,data,categories,and components,and same flags),it will receive a PendingIntent representing the same token if that is still valid,and can thus callcancel()to remove it.

唯一确定一个PendingIntent:same operation,and same flags

2,

通过context的openfileoutput()
创建的文件:
data/data/<包名>/files/config.txt

存放手机rom内存里面的.

//写文件

FileOutputStream fos = context.openFileOutput("config.txt",MODE_APPEND);
String s = "abner:clever/123";
fos.write(s.getBytes());
fos.flush();
fos.close();

//读文件

File file = new File("/data/data/cn.itcast.datasave/files/config.txt");


FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
while((len = fis.read(buffer))!=-1){
bos.write(buffer,len);
}
byte[] result = bos.toByteArray();
String content = new String(result);

3,shell下查看数据库

adb shell cd data/data/packagename/datebases/ sqlite3 dbname

猜你在找的Sqlite相关文章