手机软件功能开发(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文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219