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

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

Android SparseArray examples from Open Source projects
This code example shows how to use the following methods:
 
    private final List<RepositoryId> repos;
 
    private final int[] issues;
 
    private final SparseArray<IssueFragment> fragments = new SparseArray<IssueFragment>();
 
    private final IssueStore store;
 
    /** 
     * @param activity 
     * @param repoIds 
     * @param issueNumbers 
     * @param issueStore 
     */ 
    public IssuesPagerAdapter(SherlockFragmentActivity activity,
            List<RepositoryId> repoIds, int[] issueNumbers,
            IssueStore issueStore) {
        super(activity);
 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: saveHierarchyState
    public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
        return false; 
    } 
 
    public void saveHierarchyState(Bundle outState) {
        SparseArray<Parcelable> viewStates = new SparseArray<Parcelable>();
        if (mMenuView != null) {
            ((View) mMenuView).saveHierarchyState(viewStates);
        } 
        outState.putSparseParcelableArray(VIEWS_TAG, viewStates);
    } 
 
    public void restoreHierarchyState(Bundle inState) {
        SparseArray<Parcelable> viewStates = inState.getSparseParcelableArray(VIEWS_TAG);
        if (viewStates != null) {
            ((View) mMenuView).restoreHierarchyState(viewStates);
        } 
    } 
 
    public void setId(int id) {
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: put
	 
	private SparseArray<String> mDtNames;
	 
	public ListAdapterDB2DeviceTypes(){ 
		 
		mDtNames = new SparseArray<String>();
		mDtNames.put(1, "TV ?");
		mDtNames.put(2, "Cablebox ?");
		mDtNames.put(3, "Tuner / Hifi ?");
		mDtNames.put(4, "BD Player ?");
		mDtNames.put(5, "? ?");
	} 
	 
	@Override 
	public int getCount() { 
		return 5; 
	} 
 
	@Override 
	public Object getItem(int position) {
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: get
 
    /** 
     * Returns {@code true} if the key will be handled globally. 
     */ 
    boolean shouldHandleGlobalKey(int keyCode, KeyEvent event) {
        return mKeyMapping.get(keyCode) != null;
    } 
 
    private void loadGlobalKeys(Context context) {
        XmlResourceParser parser = null;
        try { 
            parser = context.getResources().getXml(com.android.internal.R.xml.global_keys);
            XmlUtils.beginDocument(parser, TAG_GLOBAL_KEYS);
            int version = parser.getAttributeIntValue(null, ATTR_VERSION, 0);
            if (GLOBAL_KEY_FILE_VERSION == version) {
                while (true) { 
                    XmlUtils.nextElement(parser);
                    String element = parser.getName();
                    if (element == null) {
                        break; 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: delete, get, put
 
    class RecycleBin { 
        private final SparseArray<View> mScrapHeap = new SparseArray<View>();
 
        public void put(int position, View v) {
            mScrapHeap.put(position, v);
        } 
 
        View get(int position) {
            // System.out.print("Looking for " + position); 
            View result = mScrapHeap.get(position);
            if (result != null) {
                // System.out.println(" HIT"); 
                mScrapHeap.delete(position);
            } else { 
                // System.out.println(" MISS"); 
            } 
            return result;
        } 
 
Full Snippet Info
7
CodeRank
Related Android SparseArray Questions & Answers:
See Code Examples for Android SparseArray Methods: