本文整理匯總了Java中android.support.v4.util.LongSparseArray.append方法的典型用法代碼示例。如果您正苦於以下問題:Java LongSparseArray.append方法的具體用法?Java LongSparseArray.append怎麽用?Java LongSparseArray.append使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.util.LongSparseArray
的用法示例。
在下文中一共展示了LongSparseArray.append方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Conversation
import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
/**
* This constructor is for working with cache.
*
* If contact was in cache we won't resolve contact
* but will get directly from cache.
*
* @param context Context in order to use resolve some contact parts. (Like contact)
* @param cursor cursor to get data from.
* @param contactCache so save or retrieve contact without querying...
*/
public Conversation(Context context,Cursor cursor,LongSparseArray<ArrayList<Contact>> contactCache){
this.recipientIds = cursor.getString(cursor.getColumnIndex(RECIPIENT_IDS));
this.lastMessage = cursor.getString(cursor.getColumnIndex(LAST_MESSAGE));
this.date = new Date(cursor.getLong(cursor.getColumnIndex(DATE)));
this.messageRead = cursor.getInt(cursor.getColumnIndex(IS_READ)) == 1;
this.id = cursor.getLong(cursor.getColumnIndex(THREAD_ID));
ArrayList<Contact> cached= contactCache.get(id,null);
if(cached == null){
this.contacts = resolveContacts(context,recipientIds);
// save in cache
contactCache.append(id,contacts);
}else{
this.contacts = cached;
}
}
示例2: sparseArrayFromCursor
import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
/**
* Returns data of the given cursor as {@link LongSparseArray} of item models mapped to theirs id.
*
* @return Sparse array of models with theirs corresponding data or empty array if the provided
* cursor does not have any data available or it is {@code null}.
*/
@NonNull
public static <M extends EntityModel> LongSparseArray<M> sparseArrayFromCursor(@Nullable ItemCursor<M> cursor) {
if (cursor == null || !cursor.moveToFirst()) {
return new LongSparseArray<>(0);
}
final LongSparseArray<M> collection = new LongSparseArray<>(cursor.getCount());
do {
collection.append(CursorUtils.obtainLong(cursor, Column.Primary.COLUMN_NAME), cursor.getItem());
} while (cursor.moveToNext());
return collection;
}
示例3: appendTo
import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
@Override
public SupportLongSparseArrayIterable<V> appendTo(final LongSparseArray<V> other) {
for (final LongSparseArrayEntry<V> entry : this) {
other.append(entry.getKey(), entry.getValue());
}
return this;
}
示例4: replaceValues
import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
@Override
public SupportLongSparseArrayIterable<V> replaceValues(final Translator<V, V> translator) {
final LongSparseArray<V> array = mArray;
for (final LongSparseArrayEntry<V> entry : this) {
array.append(entry.getKey(), translator.translate(entry.getValue()));
}
return this;
}
示例5: toSparseArray
import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
@Override
public LongSparseArray<V> toSparseArray() {
final LongSparseArray<V> array = new LongSparseArray<V>();
for (final LongSparseArrayEntry<V> entry : this) {
array.append(entry.getKey(), entry.getValue());
}
return array;
}
示例6: setUp
import android.support.v4.util.LongSparseArray; //導入方法依賴的package包/類
@Override
protected void setUp() throws Exception {
super.setUp();
final LongSparseArray<String> array = new LongSparseArray<String>();
for (int i = 0; i < 5; i++) {
array.append(i, String.valueOf(i));
}
mArray = array;
}