2011-12-28 17 views

答えて

0

//は、いくつかのヘルパーメソッド、特にContentUris.withAppendedId()とUri.withAppendedPathは(あり )、 URIに変換する。両方とも、IDが追加されたUriオブジェクトを返す静的メソッドです。あなたは人の連絡先のデータベースのレコード23を探していた場合は、次のように、たとえば、クエリを構築することがあります

import android.provider.Contacts.People; 
import android.content.ContentUris; 
import android.net.Uri; 
import android.database.Cursor; 

// Use the ContentUris method to produce the base URI for the contact with _ID == 23. 
Uri myPerson = ContentUris.withAppendedId(People.CONTENT_URI, 23); 

// Alternatively, use the Uri method to produce the base URI. 
// It takes a string rather than an integer. 
Uri myPerson = Uri.withAppendedPath(People.CONTENT_URI, "23"); 

// Then query for this specific record: 
Cursor cur = managedQuery(myPerson, null, null, null, null); 

refer this

関連する問題