當前位置: 首頁>>代碼示例>>Java>>正文


Java LongSparseArray.keyAt方法代碼示例

本文整理匯總了Java中android.util.LongSparseArray.keyAt方法的典型用法代碼示例。如果您正苦於以下問題:Java LongSparseArray.keyAt方法的具體用法?Java LongSparseArray.keyAt怎麽用?Java LongSparseArray.keyAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.util.LongSparseArray的用法示例。


在下文中一共展示了LongSparseArray.keyAt方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCheckedItemIds

import android.util.LongSparseArray; //導入方法依賴的package包/類
/**
 * Returns the set of checked items ids. The result is only valid if the
 * choice mode has not been set to {@link #CHOICE_MODE_NONE} and the adapter
 * has stable IDs. ({@link ListAdapter#hasStableIds()} == {@code true})
 * 
 * @return A new array which contains the id of each checked item in the
 *         list.
 */
public long[] getCheckedItemIds() {
	if (mChoiceMode == AbsListView.CHOICE_MODE_NONE
			|| mCheckedIdStates == null || mAdapter == null) {
		return new long[0];
	}

	final LongSparseArray<Integer> idStates = mCheckedIdStates;
	final int count = idStates.size();
	final long[] ids = new long[count];

	for (int i = 0; i < count; i++) {
		ids[i] = idStates.keyAt(i);
	}

	return ids;
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:25,代碼來源:AbsHListView.java

示例2: read

import android.util.LongSparseArray; //導入方法依賴的package包/類
@Override
public LongSparseArray<T> read(JsonReader jsonReader) throws IOException {
    if (jsonReader.peek() == JsonToken.NULL) {
        jsonReader.nextNull();
        return null;
    }
    LongSparseArray<Object> temp = gson.fromJson(jsonReader, typeOfLongSparseArrayOfObject);
    LongSparseArray<T> result = new LongSparseArray<>(temp.size());
    long key;
    JsonElement tElement;
    for (int i = 0, size = temp.size(); i < size; ++i) {
        key = temp.keyAt(i);
        tElement = gson.toJsonTree(temp.get(key));
        result.put(key, (T) JSONUtils.jsonToSimpleObject(tElement.toString(), typeOfT));
    }
    return result;
}
 
開發者ID:MessageOnTap,項目名稱:MessageOnTap_API,代碼行數:18,代碼來源:LongSparseArrayTypeAdapter.java

示例3: getCheckedItemIds

import android.util.LongSparseArray; //導入方法依賴的package包/類
/**
 * Returns the set of checked items ids. The result is only valid if the
 * choice mode has not been set to {@link AbsListView#CHOICE_MODE_NONE} and the adapter
 * has stable IDs. ({@link ListAdapter#hasStableIds()} == {@code true})
 *
 * @return A new array which contains the id of each checked item in the
 *         list.
 */
public long[] getCheckedItemIds() {
    if (mChoiceMode == AbsListView.CHOICE_MODE_NONE || mCheckedIdStates == null) {
        return new long[0];
    }

    final LongSparseArray<Integer> idStates = mCheckedIdStates;
    final int count = idStates.size();
    final long[] ids = new long[count];

    for (int i = 0; i < count; i++) {
        ids[i] = idStates.keyAt(i);
    }

    return ids;
}
 
開發者ID:mobvoi,項目名稱:ticdesign,代碼行數:24,代碼來源:TrackSelectionAdapterWrapper.java

示例4: CcDrawableCache

import android.util.LongSparseArray; //導入方法依賴的package包/類
public CcDrawableCache(Context context, LongSparseArray<Drawable.ConstantState> cache) {
    mResources = context.getApplicationContext().getResources();
    mPackageName = context.getApplicationContext().getPackageName();

    if (cache != null) {
        mCheckDependenciesKeys = new HashSet<>(cache.size());

        int N = cache.size();
        for (int i = 0; i < N; i++) {
            long key = cache.keyAt(i);
            mCheckDependenciesKeys.add(key);
            put(key, cache.valueAt(i));
        }
    } else {
        mCheckDependenciesKeys = new HashSet<>(0);
    }
}
 
開發者ID:Leao,項目名稱:CodeColors,代碼行數:18,代碼來源:CcDrawableCache.java

示例5: CcColorCache

import android.util.LongSparseArray; //導入方法依賴的package包/類
public CcColorCache(Context context, LongSparseArray cache) {
    mResources = context.getApplicationContext().getResources();
    mPackageName = context.getApplicationContext().getPackageName();

    if (cache != null) {
        mCheckDependenciesKeys = new HashSet<>(cache.size());

        int N = cache.size();
        for (int i = 0; i < N; i++) {
            long key = cache.keyAt(i);
            mCheckDependenciesKeys.add(key);
            put(key, cache.valueAt(i));
        }
    } else {
        mCheckDependenciesKeys = new HashSet<>(0);
    }
}
 
開發者ID:Leao,項目名稱:CodeColors,代碼行數:18,代碼來源:CcColorCache.java

示例6: getCheckedItemIds

import android.util.LongSparseArray; //導入方法依賴的package包/類
/**
 * Returns the set of checked items ids. The result is only valid if the
 * choice mode has not been set to {@link #CHOICE_MODE_NONE} and the adapter
 * has stable IDs. ({@link ListAdapter#hasStableIds()} == {@code true})
 *
 * @return A new array which contains the id of each checked item in the
 *         list.
 */
public long[] getCheckedItemIds() {
    if (mChoiceMode.compareTo(ChoiceMode.NONE) == 0 ||
            mCheckedIdStates == null || mAdapter == null) {
        return new long[0];
    }

    final LongSparseArray<Integer> idStates = mCheckedIdStates;
    final int count = idStates.size();
    final long[] ids = new long[count];

    for (int i = 0; i < count; i++) {
        ids[i] = idStates.keyAt(i);
    }

    return ids;
}
 
開發者ID:CodePath-MAF,項目名稱:AndroidClient,代碼行數:25,代碼來源:TwoWayView.java

示例7: keys

import android.util.LongSparseArray; //導入方法依賴的package包/類
private static Object keys(SparseArray<?> a, SparseBooleanArray b, SparseIntArray c,
                           SparseLongArray d, LongSparseArray<?> e) {
    int size = size(a, b, c, d, e);
    int[] ints = a != null || b != null || c != null || d != null ? new int[size] : null;
    long[] longs = e != null ? new long[size] : null;
    for (int i = 0; i < size; i++) {
        if (ints != null) {
            ints[i] = a != null ? a.keyAt(i)
                    : b != null ? b.keyAt(i) : c != null ? c.keyAt(i) : d.keyAt(i);
        } else if (longs != null) {
            longs[i] = e.keyAt(i);
        }
    }
    return ints != null ? ints : longs;
}
 
開發者ID:pushbit,項目名稱:sprockets-android,代碼行數:16,代碼來源:SparseArrays.java


注:本文中的android.util.LongSparseArray.keyAt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。