手机软件功能开发(6)

时间:2025-04-23

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

view.findViewById(R.id.insert_contacts_layout_edittext_username);

peopleName_editText.setText(peopleName);

final EditText phoneNumber_editText = (EditText) view.findViewById(R.id.insert_contacts_layout_edittext_password);

phoneNumber_editText.setText(phoneNumber);

final AlertDialog.Builder myBuilder = new AlertDialog.Builder(this);

myBuilder.setIcon(android.R.drawable.ic_dialog_info);

myBuilder.setTitle(R.string.updateContacts);

myBuilder.setView(view);

myBuilder.setPositiveButton(R.string.certain,new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {

String getPeopleName = peopleName_editText.getText().toString(); String getPhoneNum = phoneNumber_editText.getText().toString();

//得到当前选择的联系人的Phone表的Uri Uri uri = ContentUris.withAppendedId(phonesUri, id); Log.e("uri:",""+uri); //将信息放入容器中 ContentValues contentValues = new ContentValues(); //是否收藏,0不收藏,1为收藏 contentValues.put(People.STARRED, 0); contentValues.put(contacts_lable[2], getPhoneNum); //修改表中的数据 getContentResolver().update(uri, contentValues, null, null); //根据联系人的姓名查询出此联系人在People表中的数据 Cursor cusor = getContentResolver().query(peopleUri , contacts_lable , contacts_lable[1] + "=?" , new String[] { peopleName } , contacts_lable[1]+ " ASC"); cusor.moveToFirst();

//得到联系人在此表中的Uri

Uri uri2 = Uri.withAppendedPath(peopleUri, cusor.getString(cusor.getColumnIndex(contacts_lable[0])));

Log.e("uri2:",""+uri2);

ContentValues values = new ContentValues();

//是否收藏,0不收藏,1为收藏

values.put(People.STARRED, 0);

values.put(contacts_lable[1], getPeopleName);

//修改表中的数据

手机软件功能开发(6).doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

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

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

支付方式:

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

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