English 中文(简体)
2.1 如何删除与roid的联系
原标题:How to delete a contact in android 2.1

我增加了一条与甲状腺的接触。

 ContentValues values = new ContentValues();
 Uri rawContactUri = getContentResolver().insert(RawContacts.CONTENT_URI, values);
 long rawContactId = ContentUris.parseId(rawContactUri);

 values.clear();
 values.put(Data.RAW_CONTACT_ID, rawContactId);
 values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);
 values.put(StructuredName.DISPLAY_NAME, "Mike Sullivan");
 getContentResolver().insert(Data.CONTENT_URI, values);

它显示的是第2.1号声明,但当我通过“接触”方案人工删除时,它不会从支持者中删除。

如果我ed开一些事情,那就只删除了。

如何从菜单中直接删除?

预告......

问题回答

请使用以下代码添加联系。 这不会影响贵方在不编辑的情况下从菜单中删除联系。

import android.provider.Contacts.People; 

public void addvaluestocontent()
{
    ContentValues values = new ContentValues();

    values.put(People.NAME, "Abraham Lincoln");
    values.put(People._ID, "1");
    values.put(People.NUMBER, "23333");

    Uri uri = getContentResolver().insert(People.CONTENT_URI, values);
}

你们必须拯救另一个领域,即“姓氏”或“姓名”。 你们可以通过挽救接触来进行人工测试。 首先试图只节省人数,然后与姓名和号码保持接触。

简而言之,删除了所有接触文件。 roid将自动产生新的档案。

path for .db is: data/data/com.android.providers.contacts/database/contacts.db

利用这一方法检查您的SDK版本和联系内容Uri。 之后,你可以插入与新内容Uri的联系,

static 
{
int sdk=new Integer(Build.VERSION.SDK).intValue();

if (sdk>=5) {
  try {
    Class<?> clazz=Class.forName("android.provider.ContactsContract$Contacts");

    CONTENT_URI=(Uri)clazz.getField("CONTENT_URI").get(clazz);
  }
  catch (Throwable t) {
    Log.e("PickDemo", "Exception when determining CONTENT_URI", t);
  }
}
else {
  CONTENT_URI=Contacts.People.CONTENT_URI;
}
}

Refer, CommonsWare example 联系内容Uri。 这可能有助于你。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签