本文整理汇总了Java中android.provider.ContactsContract.CommonDataKinds.Note类的典型用法代码示例。如果您正苦于以下问题:Java Note类的具体用法?Java Note怎么用?Java Note使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Note类属于android.provider.ContactsContract.CommonDataKinds包,在下文中一共展示了Note类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initColumnNameConstantsMap
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
private void initColumnNameConstantsMap() {
if (mColumnNameConstantsMap != null) {
return;
}
mColumnNameConstantsMap = new HashMap<String, String>();
mColumnNameConstantsMap.put("name", StructuredName.DISPLAY_NAME);
mColumnNameConstantsMap.put("givenname", StructuredName.GIVEN_NAME);
mColumnNameConstantsMap.put("familyname", StructuredName.FAMILY_NAME);
mColumnNameConstantsMap.put("honorificprefix", StructuredName.PREFIX);
mColumnNameConstantsMap.put("honorificsuffix", StructuredName.SUFFIX);
mColumnNameConstantsMap.put("additionalname", CUSTOM_DATA_COLUMN);
mColumnNameConstantsMap.put("nickname", Nickname.NAME);
mColumnNameConstantsMap.put("adr", StructuredPostal.STREET);
mColumnNameConstantsMap.put("email", Email.ADDRESS);
mColumnNameConstantsMap.put("url", Website.URL);
mColumnNameConstantsMap.put("category", GroupMembership.GROUP_ROW_ID);
mColumnNameConstantsMap.put("tel", Phone.NUMBER);
mColumnNameConstantsMap.put("org", Organization.COMPANY);
mColumnNameConstantsMap.put("jobTitle", Organization.TITLE);
mColumnNameConstantsMap.put("note", Note.NOTE);
mColumnNameConstantsMap.put("impp", Im.DATA);
mColumnNameConstantsMap.put("sex", CUSTOM_DATA_COLUMN);
mColumnNameConstantsMap.put("genderidentity", CUSTOM_DATA_COLUMN);
mColumnNameConstantsMap.put("key", CUSTOM_DATA_COLUMN);
}
示例2: initMimeTypeConstantsMap
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
private void initMimeTypeConstantsMap() {
if (mMimeTypeConstantsMap != null) {
return;
}
mMimeTypeConstantsMap = new HashMap<String, String>();
mMimeTypeConstantsMap.put("name", StructuredName.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("givenname", StructuredName.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("familyname", StructuredName.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("honorificprefix", StructuredName.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("honorificsuffix", StructuredName.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("additionalname", MIMETYPE_ADDITIONAL_NAME);
mMimeTypeConstantsMap.put("nickname", Nickname.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("email", Email.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("url", Website.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("category", GroupMembership.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("tel", Phone.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("org", Organization.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("jobTitle", Organization.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("note", Note.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("impp", Im.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("sex", MIMETYPE_SEX);
mMimeTypeConstantsMap.put("genderidentity", MIMETYPE_GENDER_IDENTITY);
mMimeTypeConstantsMap.put("key", MIMETYPE_KEY);
}
示例3: getNote
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
private String getNote(String contactId) {
Cursor cursor = cr.query(Data.CONTENT_URI, new String[] { Data._ID,
Note.NOTE }, Data.CONTACT_ID + "=?" + " AND " + Data.MIMETYPE
+ "='" + Note.CONTENT_ITEM_TYPE + "'",
new String[] { contactId }, null);
StringBuffer sb = new StringBuffer();
if (cursor.moveToFirst()) {
do {
String noteinfo = cursor.getString(cursor
.getColumnIndex(Note.NOTE));
sb.append(noteinfo);
} while (cursor.moveToNext());
} else {
sb.append("");
}
cursor.close();
return sb.toString();
}
示例4: getNote
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
private String getNote(String contactId, ContentProviderClient namesContentClient) {
if (contactId == null || namesContentClient == null || context == null) {
return null;
}
String note = "";
String[] whereParameters = {contactId, Note.CONTENT_ITEM_TYPE};
Cursor contacts = null;
try {
contacts = namesContentClient
.query(URI_DATA, columnsNote, whereNote, whereParameters, null);
if (contacts != null && contacts.moveToFirst()) {
note = getStringByColumnName(contacts, Note.NOTE);
}
} catch (Exception e) {
Log.d(TAG, "Some error in getNote");
} finally {
if (contacts != null) {
contacts.close();
}
}
return note;
}
示例5: getNotesValues
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
private void getNotesValues(final JSONArray notes, List<ContentValues> newContactValues) throws JSONException {
if (notes == null) {
return;
}
for (int i = 0; i < notes.length(); i++) {
ContentValues contentValues = new ContentValues();
contentValues.put(Data.MIMETYPE, Note.CONTENT_ITEM_TYPE);
contentValues.put(Note.NOTE, notes.getString(i));
newContactValues.add(contentValues);
}
}
示例6: addNote
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
public ContactOperations addNote(String note) {
mValues.clear();
if (!TextUtils.isEmpty(note)) {
mValues.put(Note.NOTE, note);
mValues.put(Note.MIMETYPE, Note.CONTENT_ITEM_TYPE);
addInsertOp();
}
return this;
}
示例7: updateNote
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
public ContactOperations updateNote(String note, Uri uri) {
mValues.clear();
mValues.put(Note.NOTE, note);
mValues.put(Note.MIMETYPE, Note.CONTENT_ITEM_TYPE);
addUpdateOp(uri);
return this;
}
示例8: populateNote
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
protected void populateNote(Contact c) throws RemoteException {
@Cleanup Cursor cursor = providerClient.query(dataURI(), new String[] { Note.NOTE },
Note.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=?",
new String[] { String.valueOf(c.getLocalID()), Note.CONTENT_ITEM_TYPE }, null);
if (cursor != null && cursor.moveToNext())
c.setNote(cursor.getString(0));
}
示例9: addNote
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
public void addNote(String note) {
ops.add(ContentProviderOperation
.newInsert(android.provider.ContactsContract.Data.CONTENT_URI)
.withValueBackReference(Data.RAW_CONTACT_ID,
rawContactInsertIndex)
.withValue(Data.MIMETYPE, Note.CONTENT_ITEM_TYPE)
.withValue(Note.NOTE, note).build());
}
示例10: cursorToHashMap
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
@Override
public void cursorToHashMap(Map<String, Object> contactsMap, Cursor c) {
// 获取当前行的 mimetype用于比较
String mimetype = c.getString(c
.getColumnIndex(ContactsContract.Data.MIMETYPE));
if (StructuredName.CONTENT_ITEM_TYPE.equals(mimetype)) {
contactsMap.put(LOGIC_FIELD_DISPLAYNAME,
c.getString(c.getColumnIndex(StructuredName.DISPLAY_NAME)));
nameQuery(contactsMap, c);
} else if (Event.CONTENT_ITEM_TYPE.equals(mimetype)) {
if (Event.TYPE_BIRTHDAY == c.getInt(c.getColumnIndex(Event.TYPE))) {
contactsMap.put(LOGIC_FIELD_BIRTHDAY,
c.getString(c.getColumnIndex(Event.START_DATE)));
}
} else if (Nickname.CONTENT_ITEM_TYPE.equals(mimetype)) {
contactsMap.put(LOGIC_FIELD_NICKNAME,
c.getString(c.getColumnIndex(Nickname.NAME)));
} else if (Note.CONTENT_ITEM_TYPE.equals(mimetype)) {
contactsMap.put(LOGIC_FIELD_NOTE,
c.getString(c.getColumnIndex(Note.NOTE)));
} else {
String logicField = LOGIC_FIELD_TO_CONTENT_TYPE_MAP
.getKeyByValue(mimetype);
if (LOGIC_CONTACT_MULTIPLE_VALUE_FIELDS.contains(logicField)) {
multipleValueFieldQuery(contactsMap, c, logicField);
}
}
}
示例11: buildNote
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
protected Builder buildNote(Builder builder, String note) {
return builder
.withValue(Data.MIMETYPE, Note.CONTENT_ITEM_TYPE)
.withValue(Note.NOTE, note);
}
示例12: execute
import android.provider.ContactsContract.CommonDataKinds.Note; //导入依赖的package包/类
@Override
public Bundle execute(Context context, Request request) throws ConnectionException, DataException, CustomRequestException {
String host = context.getString(R.string.host_name);
int length = request.getInt("length");
String address = "http://" + host + "/api/snote/";
NetworkConnection connection = new NetworkConnection(context, address);
ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
String sessionHash = request.getString("session_hash");
params.add( new BasicNameValuePair("session_hash", sessionHash) );
List<String> IDs = new ArrayList<String>();
for(int i=0; i<length; i++){
String id = String.valueOf( request.getLong("id"+i) );
IDs.add(id);
params.add(new BasicNameValuePair("id", id));
}
connection.setParameters(params);
String where = "(";
for (int i=0; i<IDs.size(); i++){
where += "?,";
}
where = where.substring(0, where.length()-1) + ")";
connection.setMethod(Method.DELETE);
ConnectionResult result = connection.execute();
try {
JSONObject JSONRoot = new JSONObject(result.body);
JSONObject JSONStatus = JSONRoot.getJSONObject("status");
int code = JSONStatus.getInt("code");
if (code < 200 || code >= 300){
throw new JSONException("ok message not found");
}
} catch (JSONException e) {
throw new CustomRequestException(result.body) {
private static final long serialVersionUID = 1L;
};
}
context.getContentResolver().delete(
RestContact.Note.CONTENT_URI
, Note._ID+" in " + where
, IDs.toArray( new String[IDs.size()] )
);
return null;
}