Design an Android application that will demonstrate widgets such as RadioButtons, CheckBoxes, SeekBars, and ImageViews. The application will count calories for custom burgers. As various selections are made for the burger, the calorie count will be directly computed and displayed in a TextView object.

  • Three images are available for download . They are images for the background of the application, the top bun of the burger, and the bottom bun of the burger. The top and bottom buns should be displayed using ImageView widgets.
  • Use a vertical LinearLayout.
  • Use a RadioGroup with 3 vertical RadioButtons for the burger patty options: beef, turkey, and veggie.
  • A second RadioGroup with 3 horizontal RadioButtons should be used for the cheese options, no cheese, cheddar, and mozzarella.
  • For each RadioGroup, make sure to pick one option as a default.
  • Use a CheckBox to indicate whether bacon should be placed on the burger.
  • Use a TextView and SeekBar object to indicate the amount of special sauce to put on the burger, up to one teaspoon. Hint: Measurements can be 1/4, 1/2, 3/4 and full teaspoon.
  • Use a TextView to display the calculated calorie count.
  • Create a separate class in your application to hold the calorie information about the burger that is being built. At a minimum, it should contain instance variables to hold the calories for the burger patty (int), calories for the cheese (int), calories for the bacon (int), and calories for the special sauce (int). It should also contain constants for the number of calories for a beef patty, turkey patty, veggie patty, bacon, cheddar cheese, and mozzarella cheese

Figure: see image.

Widgets, Classes and Methods Used in This App

RadioButton - This is a single item that can be selected from a collection of items.

RadioGroup - This is a collection of RadioButtons.

OnCheckedChangeListener - This will "listen" for a change to a grouping of RadioButtons.

  • Contains a method named onCheckedChanged that is called when a RadioButton is selected.
  • The arguments:
    • RadioGroup - The RadioGroup where the change was made.
    • int - The id number of RadioButton that was selected. This can be found in the R.java file or by using R.id qualifier.

setOneCheckChangeListener - This sets a specific OnCheckedChangeListener for a RadioGroup.

CheckBox - This is a two-state button that can either be checked or unchecked.

OnClickListener - This will "listen" for a change to a CheckBox. Contains the onClick method that is called when a CheckBox is selected or unselected.

setOnClickListener - This sets a specific OnClickListener for a CheckBox.

SeekBar - This is a draggable progress bar that allows the user to make changes.

OnSeekBarChangeListener - This will "listen" for a change to a SeekBar.

  • Contains three methods but the only one needed here is the onProgressChanged that is called when a SeekBar is moved left or right.
  • The arguments:
    • SeekBar - The SeekBar where the change was made.
    • int - The current progress level.
    • boolean - Indicates if the progress change was initiated by the user.

setOnSeekBarChangeListener - This sets a specific onSeekBarChangeListener for a SeekBar.

Your work layout must be same as the picture given above.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.