Professional Documents
Culture Documents
Question Bank and Answer-IV
Question Bank and Answer-IV
Question Bank and Answer-IV
• In android, we use radio buttons with in a RadioGroup to combine multiple radio buttons into
one group and it will make sure that users can select only one option from the group of multiple
options.
• By default, the android RadioButton will be in OFF (Unchecked) state. We can change the
default state of RadioButton by using android:checked attribute.
• In case, if we want to change the state of RadioButton to ON (Checked), then we need to
set android:checked = “true” in our XML layout file.
Q6. Explain RadioGroup Views
In android, Radio Group is used to group one or more radio buttons into separate groups based on our
requirements.
If we group Radio Buttons using RadioGroup, at a time only one item can be selected from the group of radio
buttons. In case, if we select one radio button that belongs to a radio group will unselect all other previously
selected radio buttons within the same group.
Initially, all the radio buttons of the radio group are in the unchecked state, once we select a radio button then
it’s not possible for us to uncheck it like CheckBox control.
Following is the pictorial representation of grouping RadioButton controls using RadioGroup in android
applications.
Android RadioGroup Example
Following is the example of defining multiple RadioButton controls in RadioGroup, one TextView control and
one Button control in RelativeLayout to get the selected values of RadioButton controls when we click
on Button in the android application.
Create a new android application using android studio and give names as RadioButtonExample. In case if you
are not aware of creating an app in android studio check this article Android Hello World App.
Q7. Explain RadioGroup Views
In android, ProgressBar is a user interface control that is used to indicate the progress of an operation. For
example, downloading a file, uploading a file.
Q8. Explain AutoCompleteTextView View
• Android AutoCompleteTextView completes the word based on the reserved words, so no need to
write all the characters of the word.
• Android AutoCompleteTextView is a editable text field, it displays a list of suggestions in a drop
down menu from which user can select only one suggestion or value.
• Android AutoCompleteTextView is the subclass of EditText class. The
MultiAutoCompleteTextView is the subclass of AutoCompleteTextView class.
• Using Array Adapter To Display Text Values In AutoCompleteTextView:
• To display the Array content in an autocompletetextview we need to implement Adapter. In
AutoCompleteTextView we mainly display text values so we use Array Adapter for that.
• ArrayAdapter In Android:
• ArrayAdapter is used when we need list of single type of items which is backed by an Array. For
example, list of phone contacts, countries or names.
• ArrayAdapter code:
•
Q9 Explain Web view
• Android WebView is used to display web page in android. The web page can be loaded from same
application or URL. It is used to display online content in android activity.
• Android WebView uses webkit engine to display web page.
• The android.webkit.WebView is the subclass of AbsoluteLayout class.
• The loadUrl() and loadData() methods of Android WebView class are used to load and display
web page.
• Date Picker and Timer Picker Dialog in our android application. These components are used to
select date and time in a customised user interface. We will use DatePickerDialog and
TimePickerDialog classes with Calendar class in our android application code to achieve this.
For code: https://www.journaldev.com/9976/android-date-time-picker-dialog