Android SparseBooleanArray - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android SparseBooleanArray class.

This code example shows how to use the following methods:append
            ctv.setTypeface(roboto.getTypeface(position));
            ctv.setOnClickListener(new OnClickListener() {
                @Override 
                public void onClick(View v) {
                    ctv.toggle();
                    checked.append(position, ctv.isChecked());
                } 
            }); 
            return view;
        } 
 
    } 
 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:clear, get, put, size, valueAt
     * 
     * @see #setChoiceMode(int) 
     */ 
    public boolean isItemChecked(int position) {
        if (mChoiceMode != CHOICE_MODE_NONE && mCheckStates != null) {
            return mCheckStates.get(position);
        } 
 
        return false; 
    } 
 
    /** 
     * Returns the set of checked items in the list. The result is only valid if 
     * the choice mode has not been set to {@link #CHOICE_MODE_NONE}. 
     * 
     * @return  A SparseBooleanArray which will return true for each call to 
     *          get(int position) where position is a position in the list, 
     *          or <code>null</code> if the choice mode is set to 
     *          {@link #CHOICE_MODE_NONE}. 
     */ 

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
import android.util.SparseBooleanArray; 
 
public class ItemPositionsObservable extends 
	ObservableCollection<Boolean>{
	 
	private SparseBooleanArray arr = new SparseBooleanArray();
 
	public Boolean getItem(int position) {
		return arr.valueAt(position);
	} 
 
	public void onLoad(int position) {
	} 
 
	public Class<Boolean> getComponentType() {
		return Boolean.class;
	} 
 
	public int size() { 
		return arr.size();
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:delete, get
		return super.onKeyDown(keyCode, event);
	} 
 
	@Override 
	public boolean onKeyUp(int keyCode, KeyEvent event) {
		if( event.getAction() == KeyEvent.ACTION_UP && pressed_key.get(keyCode) ){
			pressed_key.delete(keyCode);
			switch(keyCode){
			case KeyEvent.KEYCODE_BACK:
				procBackKey(); 
				return true; 
			case KeyEvent.KEYCODE_MENU:
				procMenuKey(); 
				return true; 
			} 
		} 
		return super.onKeyUp(keyCode, event);
	} 
	 
	protected void  procMenuKey() { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:get, put
        } 
        return v;
    } 
 
    public boolean isChecked(int position) {
        return mCheckStates.get(position, false);
    } 
 
    public void setChecked(int position, boolean isChecked) {
        mCheckStates.put(position, isChecked);
        notifyDataSetChanged();
    } 
 
    public void toggle(int position) {
        setChecked(position, !isChecked(position));
    } 
 
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        mCheckStates.put((Integer) buttonView.getTag(), isChecked);
    } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    this.items = items;
    if (items != null)
      size = items.size();
 
    previousPostition = -1;
    positionsMapper = new SparseBooleanArray(size);
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    width = windowManager.getDefaultDisplay().getWidth();
    height = windowManager.getDefaultDisplay().getHeight();
 
    defineInterpolator(); 
  } 
 
  @Override 
  public int getCount() { 
    return size;
  } 
 
  @Override 
  public Object getItem(int position) {
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:get, put
	} 
 
	@Override 
	public void toggleCheck(int position, long id) {
		final int key = (int) id;
		final boolean newValue = !mCheckedIds.get(key);
		mCheckedIds.put(key, newValue);
		notifyDataSetChanged(); 
	} 
 
	public void uncheck(long id) {
		final int key = (int) id;
		mCheckedIds.delete(key);
		notifyDataSetChanged(); 
	} 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     */ 
    public BaseCheckableAdapter(final Context context, final List<T> data, final int layoutResourceId) {
        inflater = LayoutInflater.from(context);
        items = data;
        this.layoutResourceId = layoutResourceId;
        selectedItems = new SparseBooleanArray();
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    public void clearSelections() { 
        selectedItems = new SparseBooleanArray();
 
        notifyDataSetChanged();
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        if (checkedPositions != null)
        { 
            return checkedPositions;
        } 
 
        return new SparseBooleanArray();
    } 
 
    public void setCurrentlyCheckedPositions(SparseBooleanArray checkedPositions)
    { 
        this.checkedPositions = checkedPositions;
    } 
 
    public void setCameraFileObserver(FileObserver cameraFileObserver)
    { 
        this.cameraFileObserver = cameraFileObserver;
    } 
 
    public FileObserver getCameraFileObserver()
    { 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:clear, get, put
        } else { 
            boolean updateIds = mCheckedIdStates != null && getAdapter().hasStableIds();
            // Clear all values if we're checking something, or unchecking the currently 
            // selected item 
            if (value || isItemChecked(position)) {
                mCheckStates.clear();
                if (updateIds) {
                    mCheckedIdStates.clear();
                } 
            } 
            // this may end up selecting the value we just cleared but this way 
            // we ensure length of mCheckStates is 1, a fact getCheckedItemPosition relies on 
            if (value) {
                mCheckStates.put(position, true);
                if (updateIds) {
                    mCheckedIdStates.put(getAdapter().getItemId(position), Boolean.TRUE);
                } 
            } 
        } 
         

5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android SparseBooleanArray Questions & Answers:

See Code Examples for Android SparseBooleanArray Methods: