Best code examples for Android SparseIntArray class (android.util.SparseIntArray)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android SparseIntArray class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android SparseIntArray examples from Open Source projects
This code example shows how to use the following methods: indexOfValue, keyAt
    public int getListPosition(int cursorPosition) {
        if (mRemovedCursorPositions.contains(cursorPosition)) {
            return REMOVED;
        } 
 
        int index = mListMapping.indexOfValue(cursorPosition);
        if (index < 0) {
            return cursorPosition;
        } else { 
            return mListMapping.keyAt(index);
        } 
    } 
 
 
} 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: indexOfKey, put
        } 
 
        public boolean onKeyUp(KeyEvent event) {
            final int keyCode = event.getKeyCode();
            if (isGameKey(keyCode)) {
                int index = mKeys.indexOfKey(keyCode);
                if (index >= 0) {
                    final String symbolicName = KeyEvent.keyCodeToString(keyCode);
                    mKeys.put(keyCode, 0);
                    Log.i(TAG, mDevice.getName() + " - Key Up: " + symbolicName);
                } 
                return true; 
            } 
            return false; 
        } 
 
        public boolean onJoystickMotion(MotionEvent event) {
            StringBuilder message = new StringBuilder();
            message.append(mDevice.getName()).append(" - Joystick Motion:\n");
 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: indexOfValue, keyAt
This code example shows how to use the following methods: append
 
    /** 
     */ 
    @Override 
    protected void onPrepareAttributes(SparseIntArray attributes) {
        super.onPrepareAttributes(attributes);
 
        // Add all attributes which should be parsed for view group widget. 
        attributes.append(android.R.attr.padding, android.R.attr.padding);
        attributes.append(android.R.attr.paddingLeft, android.R.attr.paddingLeft);
        attributes.append(android.R.attr.paddingTop, android.R.attr.paddingTop);
        attributes.append(android.R.attr.paddingRight, android.R.attr.paddingRight);
        attributes.append(android.R.attr.paddingBottom, android.R.attr.paddingBottom);
    } 
 
    /** 
     */ 
    @Override 
    protected void onParseStyleElement(int attr, int index, TypedArray typedArray) {
        switch (attr) {
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: get, indexOfKey, indexOfValue, keyAt, valueAt
    } 
 
    @Override 
    public int getPositionForSection(int section){
        LogUtils.d("section: " + section);
        LogUtils.v("mIndexer.get(section): " + mIndexer.get(section));
        LogUtils.v("mIndexer.keyAt(section): " + mIndexer.keyAt(section));
        LogUtils.v("mIndexer.valueAt(section): " + mIndexer.valueAt(section));
        LogUtils.v("mIndexer.indexOfKey(section): " + mIndexer.indexOfKey(section));
        LogUtils.v("mIndexer.indexOfValue(section): " + mIndexer.indexOfValue(section));
        // keyAt は スクロールバーのつまみが一致するがスクロールすると突き抜けていく 
        int position = mIndexer.keyAt(section);
        LogUtils.e("position: " + position);
        return position;
    } 
 
    @Override 
    public int getSectionForPosition(int position){
        LogUtils.i("position: " + position);
        LogUtils.w("mIndexer.get(position): " + mIndexer.get(position));
Full Snippet Info
6
CodeRank
Related Android SparseIntArray Questions & Answers:
See Code Examples for Android SparseIntArray Methods: