Code example for SparseArray

0
     
    public ShortcutManager(Context context, Handler handler) {
        super(handler);
         
        mContext = context;
        mShortcutIntents = new SparseArray<Intent>();
    } 
 
    /** Observes the provider of shortcut+intents */ 
    public void observe() { 
        mCursor = mContext.getContentResolver().query(
                Settings.Bookmarks.CONTENT_URI, sProjection, null, null, null);
        mCursor.registerContentObserver(this);
        updateShortcuts(); 
    } 
 
    @Override 
    public void onChange(boolean selfChange) {
        updateShortcuts(); 
    }