判断是否为SIM卡联系人
判断是否为SIM卡联系人
在AsyncQueryContacts类中。
private List<TxrjAccount> accounts = new ArrayList<TxrjAccount>();
private HashMap<Integer, TxrjAccount> accountMap = new HashMap<Integer, TxrjAccount>();
public AsyncQueryContacts(ContentResolver cr) {
super(cr);
initAccounts();
}
private void initAccounts() {
Cursor cursor = mContext.getContentResolver().query(ContactsContract.RawContacts.CONTENT_URI,
new String[] {RawContacts._ID, RawContacts.ACCOUNT_NAME, RawContacts.ACCOUNT_TYPE },
null, null, null);
if (cursor != null) {
TxrjAccount account = null;
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex(RawContacts._ID));
String name = cursor.getString(cursor.getColumnIndex(RawContacts.ACCOUNT_NAME));
String type = cursor.getString(cursor.getColumnIndex(RawContacts.ACCOUNT_TYPE));
account = new TxrjAccount(id, name, type);
accounts.add(account);
accountMap.put(id, account);
}
cursor.close();
}
}
在AsyncQueryContacts.onQueryComplete()方法中。
if(contact.getPhoneList().size() == 1){
contact.setbSim(accountMap.get(phone.getRawContactId()).isSimAccount());
}
在TxrjAccount类中。
public static final String PHONE_ACCOUNT_NAME = "vnd.sec.contact.phone";
public static final String PHONE_ACCOUNT_TYPE = "vnd.sec.contact.phone";
public static final String SIM2_ACCOUNT_NAME = "primary.sim2.account_name";
public static final String SIM2_ACCOUNT_TYPE = "vnd.sec.contact.sim2";
public static final String SIM_ACCOUNT_NAME = "primary.sim.account_name";
public static final String SIM_ACCOUNT_TYPE = "vnd.sec.contact.sim";
public boolean isSimAccount() {
if(type.equals(SIM_ACCOUNT_TYPE) || type.equals(SIM2_ACCOUNT_TYPE)) {
return true;
} else {
return false;
}
}
判断是否为SIM卡联系人的更多相关文章
- android 判断是否有sim卡及运营商
判断是否有sim卡的方法: int absent = TelephonyManager.SIM_STATE_ABSENT; if (1 == absent) { Log.d(TAG,"请 ...
- sim卡联系人name为空的问题。
1,之前的版本出现Bug:新建name为空的sim卡联系人,无法删除. 解决: 2,而后的版本出现新Bug:新建name不为空,Num不为空的sim卡联系人,然后编辑sim卡联系人,将Name清空,无 ...
- Android--获取手机联系人和Sim卡联系人
最近公司做的一个放贷APP,要求后台偷偷获取用户的联系人来做风控,所以...(大家忽略就好) 获取手机联系人很简单,就是查询android的数据库,用到的是ContentProvider进行跨进程通讯 ...
- android中判断sim卡状态和读取联系人资料的方法
在写程序中,有时候可能需要获取sim卡中的一些联系人资料.在获取sim卡联系人前,我们一般会先判断sim卡状态,找到sim卡后再获取它的资料,如下代码我们可以读取sim卡中的联系人的一些信息. Pho ...
- 十九、android中判断sim卡状态和读取联系人资料的方法
在写程序中,有时候可能需要获取sim卡中的一些联系人资料.在获取sim卡联系人前,我们一般会先判断sim卡状态,找到sim卡后再获取它的资料,如下代码我们可以读取sim卡中的联系人的一些信息. Pho ...
- android2.2应用开发之IccCard(sim卡或USIM卡)
tyle="margin:20px 0px 0px; font-size:14px; line-height:26px; font-family:Arial; color:rgb(51,51 ...
- android2.2应用开发之IccCard(sim卡或USIM卡)(转至 http://www.2cto.com/kf/201306/223784.html)
如果要做android通讯录的联系人的机卡混排显示,由于手机卡类型的不同,导致手机卡存储容量以及可以存储信息不同,就要涉及到android去读Icc卡的信息. 一般的sim卡只能存储姓名跟一个电话号码 ...
- android131 360 05 手势触摸滑动,sim卡,开机启动的广播,手机联系人,SharedPreferences,拦截短信
安卓手势触摸滑动: package com.itheima52.mobilesafe.activity; import android.app.Activity; import android.con ...
- Android 判断SIM卡属于哪个移动运营商
第一种方法:获取手机的IMSI码,并判断是中国移动\中国联通\中国电信 TelephonyManager telManager = (TelephonyManager) getSystemServic ...
随机推荐
- Dictionary GetOrAdd
public static TValue GetOrAdd<TKey,TValue>( this Dictionary<TKey,TValue> dictionary, TKe ...
- JDK1.6官方下载_JDK6官方下载
JDK1.6官方下载_JDK6官方下载地址: http://www.java.net/download/jdk6/6u10/promoted/b32/binaries/jdk-6u10-rc2-bin ...
- Android图片加载框架最全解析(六),探究Glide的自定义模块功能
不知不觉中,我们的Glide系列教程已经到了第六篇了,距离第一篇Glide的基本用法发布已经过去了半年的时间.在这半年中,我们通过用法讲解和源码分析配合学习的方式,将Glide的方方面面都研究了个遍, ...
- there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
建表语句: create table test_table( id integer not null auto_increment primary key, stamp_created tim ...
- Objective-C:Objective-C:文件中一些对目录进行操作的函数
IO文件中,一些对目录进行操作的函数:获取.切分.组合 一些对目录进行操作的函数: 获取用户的姓名:(NSString*)NSUserName() ; ———>NSString *Str ...
- 认识Mac中的那些符号
今天看到这篇文章,讲了Mac中的各种符号,还是很不错的. http://www.cnblogs.com/jimcheng/articles/4156268.html
- mysql命令用法复习笔记
show DATABASES ; create database nulige character set utf8; use nulige; show tables; #创建表 CREATE TAB ...
- java 判断字符串是否相等 (转)
http://blog.csdn.net/chtnj/article/details/7909720 判断字符串相等我们经常习惯性的写上if(str1==str2),这种写法在java中可能会带来问题 ...
- php5.2以下版本无json_decode函数的解决办法
function json_decode2($json) { $comment = false; $out = '$x='; for ($i=0; $i<strlen($json); $i+ ...
- [Tools] Target specific browsers with babel-preset-env and the babel pollyfill (browserslist)
Converting all of our modern JavaScript into ES5 compatible syntax is a great way to use modern feat ...