Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with an app, I'm still new to Android studio so if someone could look over my code and tell me what I'm
I need help with an app, I'm still new to Android studio so if someone could look over my code and tell me what I'm doing wrong or just fix it then I'd greatly appreciate it!
I need to create a pizza app in Android Studio using Java with the following requirements:
Here's the code that I've written so far:
package com.example.pizzalabpartone; import android.os.Bundle; import android.view.View; import android.widget.CheckBox; import android.widget.RadioButton; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import java.security.cert.Extension; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Coding for Crust Radio Buttons TextView crustTextView = (TextView) findViewById(R.id.crustTextView); crustTextView.setText("Crust"); RadioButton crispyRadioButton = (RadioButton) findViewById(R.id.crispyRadioButton); crispyRadioButton.setText("Crispy"); RadioButton thickRadioButton = (RadioButton) findViewById(R.id.thickRadioButton); thickRadioButton.setText("Thick"); RadioButton soggyRadioButton = (RadioButton) findViewById(R.id.soggyRadioButton); soggyRadioButton.setText("Soggy"); public void onRadioButtonClicked (View Extension view){ boolean checked = ((RadioButton) view).isChecked(); switch (view.getId()) { case R.id.crispyRadioButton: if (checked) break; case R.id.thickRadioButton: if (checked) break; case R.id.soggyRadioButton: if (checked) break; } } //Coding for Topping Check Boxes TextView toppingsTextView = (TextView) findViewById(R.id.toppingsTextView); toppingsTextView.setText("Topping"); CheckBox anchCheckBox = (CheckBox) findViewById(R.id.anchCheckBox); anchCheckBox.setText("Anchovies"); CheckBox pineCheckBox = (CheckBox) findViewById(R.id.pineCheckBox); pineCheckBox.setText("Pineapples"); CheckBox garlicCheckBox = (CheckBox) findViewById(R.id.garlicCheckBox); garlicCheckBox.setText("Garlic"); CheckBox okraCheckBox = (CheckBox) findViewById(R.id.okraCheckBox); okraCheckBox.setText("Okra"); public void onCheckboxClicked(View Extension view) { boolean checked = ((CheckBox) view).isChecked(); switch(view.getId()) { case R.id.anchCheckBox: if (checked) break; case R.id.pineCheckBox: if (checked) break; case R.id.garlicCheckBox: if (checked); break; case R.id.okraCheckBox: if (checked); break; } } //Coding for Delivery Option Radio Buttons TextView togoTextView = (TextView) findViewById(R.id.togoTextView); togoTextView.setText("Dine-in or Carryout?"); RadioButton restRadioButton = (RadioButton) findViewById(R.id.restRadioButton); restRadioButton.setText("At the Restaurant"); RadioButton pickupRadioButton = (RadioButton) findViewById(R.id.pickupRadioButton); pickupRadioButton.setText("Pickup"); RadioButton deliverRadioButton = (RadioButton) findViewById(R.id.deliverRadioButton); deliverRadioButton.setText("Delivery"); onRadioButtonClicked (View Extension view){ boolean checked = ((RadioButton) view).isChecked(); switch (view.getId()) { case R.id.restRadioButton: if (checked) break; case R.id.pickupRadioButton: if (checked) break; case R.id.deliverRadioButton: if (checked) break; } } //Coding for the SeekBar final SeekBar size_num; final TextView barSize_num; public void seekBar () { size_num = (SeekBar) findViewById(R.id.onlySeekBar); barSize_num = (TextView) findViewById(R.id.seekBarSizeTextView); barSize_num.setText(size_num.getProgress() + "/" + size_num.getMax()); size_num.setOnSeekBarChangeListener( new SeekBar.OnSeekBarChangeListener() { int progress_value; @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { progress_value = progress; barSize_num.setText(progress + "/" + size_num.getMax()); Toast.makeText(MainActivity.this, "SeekBar in progress", Toast.LENGTH_LONG).show(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { Toast.makeText(MainActivity.this, "SeekBar in StartTracking", Toast.LENGTH_LONG).show(); } @Override public void onStopTrackingTouch(SeekBar seekBar) { barSize_num.setText("Covered : " + progress_value + " / " + size_num.getMax()); Toast.makeText(MainActivity.this, "SeekBar in StopTracking", Toast.LENGTH_LONG).show(); } } ); } } }Requirements Create a pizza pricing application shown as follows: Crispy MainActivity Crust Topping Anchovies O Thick Pineapple O Soggy Garlic Okra To go or no? At restaurant O Pickup Deliver Size 29 in There are several important points that are general requirements for labs in this course: Use a separate Android Studio project for each lab, unless otherwise instructed. Include a comment at the beginning of each source file (java files) you submit that includes your name and the lab date. Names for variables and other program components should be chosen to help convey the meaning of the variable
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started