手机版

手机软件功能开发(8)

时间:2025-04-23   来源:未知    
字号:

Android手机系统的手机功能开发例子

* 查询,peopleName==*查询全部 */ private void queryContacts(String peopleName) {

//查询联系人

StringBuilder buffer = null;

String[] keyword = null;

if (peopleName != null) {

buffer = new StringBuilder();

buffer.append("UPPER(");

buffer.append(contacts_lable[1]);

buffer.append(") GLOB ?");

keyword = new String[] { peopleName.toString().toUpperCase() + "*" }; }

Cursor cursor = getContentResolver().query(phonesUri

, contacts_lable

, buffer == null ? null : buffer.toString()//查询条件 , keyword//查询条件 , People.DEFAULT_SORT_ORDER);//顺序 contactslist = null; contactslist = new ArrayList<Map<String, Object>>(); //取出查询结果 if (cursor.moveToFirst()) { String id = null; String name = null; String phoneNumber = null; while(cursor.getPosition()!=cursor.getCount()){ id = cursor.getString(cursor.getColumnIndex(contacts_lable[0])); name = cursor.getString(cursor.getColumnIndex(contacts_lable[1])); phoneNumber = cursor.getString(cursor.getColumnIndex(contacts_lable[2])); Map<String, Object> map = new HashMap<String, Object>(); map.put(contacts_lable[0], id); map.put(contacts_lable[1], name); map.put(contacts_lable[2], phoneNumber); contactslist.add(map); cursor.moveToNext(); } }else{ Toast.makeText(this, "无联系人信息!", Toast.LENGTH_LONG).show();

手机软件功能开发(8).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
×
二维码
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)