image1 image2 image3

HELLO I'M NITENDRA THAKUR|WELCOME TO MY PERSONAL BLOG|I LOVE TO DO CREATIVE THINGS|I'M PROFESSIONAL ANDROID APPLICATION DEVELOPER

example of checkbox in android programming?




1.CheckBox


CheckBoxes allow the user to select one or more options from a set. Typically, you should present each CheckBox option in a vertical list.A CheckBox is a specific type of two-states button that can be either checked or unchecked.


2.How to use CheckBox?

  • To use CheckBox ,create or drag and drop the Checkbox view into the Application layout.
  • Checkbox allows user to select multiple item.
  • Define the checkBox resource by creating the object and finding the resource id by following line
        final CheckBox checkbox =(CheckBox)findViewById(R.id.checkbox1);
  • Register a click listener for each CheckBox view.
  • Implements the method.
         public void onClick(View view)
              {
                 if(checked)
                           // check the choice
                 else
                           // uncheck the choice
               }

3.     Methods of CheckBox



  • public void onIntializedAccessibilityEvent(AccessibiltyEvent event) called when the source of an accessibility event is the view whose state change triggered firing the event.
  • public void onIntializedAccessibilityNodeInfo(AccessibilityNodeInfo info) called to initialize an AccessibilityNodeInfo with information about the view. the base implementation sets :

  1. setParent(View),
  2. setBoundsInParent(Rect),
  3. setBoundsInScreen(Rect),
  4. setPackageName(CharSequence),
  5. setClassName(CharSequence),
  6. setContentDescription(CharSequence),
  7. setEnabled(boolean),
  8. setClickable(boolean),
  9. setFocusable(boolean),
  10. setFocused(boolean),
  11. setLongClickable(boolean),
  12. setSelected(boolean)

4.Download the CheckBox sample :CheckBoxDemo.zip


Share this:

CONVERSATION

0 comments:

Post a Comment