当前位置: 编程技术>移动开发
本页文章导读:
▪google map api 应用 google map api 使用
http://www.cnblogs.com/linjiqin/archive/2011/11/01/2232055.html#2232935
......
▪ 两种退出步骤 两种退出方法
方法 一:
退出发送广播,一个BaseActivitiy中监听广播,finish自己,其余activity基础此activity
方法二:查找进程,kill之(需root?)
private void exit()
{
String packageName = "com..........
▪ 查看电话记要-CallLog.Calls.CONTENT_URI 查看电话记录---CallLog.Calls.CONTENT_URI
查询的联系人名字(CallLog.Calls.CACHED_NAME), 中CallLog.Calls.TYPE就是电话类型, 电话号码(CallLog.Calls.NUMBER)
for (int i = 0; i < cursor.getCount(); i++) {
cursor.moveToPos.........
[1]google map api 应用
来源: 互联网 发布时间: 2014-02-18
google map api 使用
http://www.cnblogs.com/linjiqin/archive/2011/11/01/2232055.html#2232935
http://www.cnblogs.com/linjiqin/archive/2011/11/01/2232055.html#2232935
[2] 两种退出步骤
来源: 互联网 发布时间: 2014-02-18
两种退出方法
方法 一:
退出发送广播,一个BaseActivitiy中监听广播,finish自己,其余activity基础此activity
方法二:查找进程,kill之(需root?)
private void exit()
{
String packageName = "com.huawei.softclient.mtvclient";
String processId = "";
try
{
Runtime r = Runtime.getRuntime();
Process p = r.exec("ps");
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String inline;
while ((inline = br.readLine()) != null)
{
if (inline.endsWith(packageName))
{
break;
}
}
br.close();
StringTokenizer processInfoTokenizer = new StringTokenizer(inline);
int count = 0;
while (processInfoTokenizer.hasMoreTokens())
{
count++;
processId = processInfoTokenizer.nextToken();
if (count == 2)
{
break;
}
}
Log.d(TAG,"processId:"+processId);
r.exec("kill -15 " + processId);
}
catch (IOException ex)
{
Log.d(TAG,
"Kill process failed",
ex);
}
}
[3] 查看电话记要-CallLog.Calls.CONTENT_URI
来源: 互联网 发布时间: 2014-02-18
查看电话记录---CallLog.Calls.CONTENT_URI
查询的联系人名字(CallLog.Calls.CACHED_NAME),
中CallLog.Calls.TYPE就是电话类型,
电话号码(CallLog.Calls.NUMBER)
for (int i = 0; i < cursor.getCount(); i++) {
cursor.moveToPosition(i);
//注意,如果数据表里面有一个字段:type,查询的时候,若没有设置要查type,那么在cursor里面读type的数据时候就会出现找不到列:type
//读取数据可以理解是从cursor里面读的,当初你没查type这个字段,查询结果里面没有type的数据,当然cursor里面也就没有了
if(cursor.getString(cursor.getColumnIndexOrThrow(CallLog.Calls.CACHED_NAME))== null){
item.add("联系人列表无此记录");
}else{
item.add(cursor.getString(cursor.getColumnIndexOrThrow(CallLog.Calls.CACHED_NAME)));
}
item_2.add(cursor.getString(cursor.getColumnIndexOrThrow(CallLog.Calls.NUMBER)));
}
final Cursor cursor = cr.query(CallLog.Calls.CONTENT_URI, new String[]{CallLog.Calls.NUMBER,CallLog.Calls.CACHED_NAME,CallLog.Calls.TYPE}, null, null,CallLog.Calls.DEFAULT_SORT_ORDER);
中CallLog.Calls.TYPE就是电话类型,
public class CallLog 类中:
public static final int INCOMING_TYPE = 1;
public static final int OUTGOING_TYPE = 2;
public static final int MISSED_TYPE = 3;
不难看出来电:1,拨出:2,未接:3
至于记录时间,Calls里面有DATE可查,查出来的结果是毫秒级的时间,需要转换时间格式
//=====================================================
时间格式化 :
SimpleDateFormat sfd = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date date = new Date(Long.parseLong(cursor.getString(cursor.getColumnIndexOrThrow(CallLog.Calls.DATE))));
String time = sfd.format(date);//格式化的效果:例如2010-01-08 09:10:11
最新技术文章: