Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

package com.example.admin.hw4; import android.app.Activity import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.Toast; import android.widget.ProgressBar; import android.view.Menu; import android.view.MenuInflater public

package com.example.admin.hw4;

import android.app.Activity

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

import android.widget.CheckBox;

import android.widget.CompoundButton;

import android.widget.Toast;

import android.widget.ProgressBar;

import android.view.Menu;

import android.view.MenuInflater

public class MainActivity extends AppCompatActivity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_hw4);

findViewById(R.id.hi).setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

Toast.makeText(MainActivity.this,"Calories Burned",Toast.LENGTH_LONG).show();

}

});

findViewById(R.id.by ).setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

Toast.makeText(MainActivity.this,"Heart Rate",Toast.LENGTH_LONG).show();

}

});

final CheckBox c1=findViewById(R.id.checkbox);

final CheckBox c2=findViewById(R.id.checkbox);

c1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

@Override

public void onCheckedChanged(CompoundButton compoundButton, boolean b) {

if(c1.isChecked()){

c1.setText("Weight");

}else

{

c1.setText("Height");

}

}

});

c2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

@Override

public void onCheckedChanged(CompoundButton compoundButton, boolean b) {

if(c2.isChecked()){

c2.setText("Height");

}else

{

c2.setText("Weight");

}

}

});

}

}

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_hw4);

final ProgressBar simpleProgressBar = findViewById(R.id.simpleProgressBar);

simpleProgressBar.setOnClickListener(new View.OnClickListener);

}

}

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_hw4);

editTxt = (EditText) findViewById(R.id.editText);

btn = (Button) findViewById(R.id.button);

list = (ListView) findViewById(R.id.listView);

arrayList = new ArrayList();

adapter=new ArrayAdapter(getApplicationContext(),android.R.layout.simple_spinner_item,arrayList);

list.setAdapter(adapter);

btn.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

arrayList.add(editTxt.getText().toString());

adapter.notifyDataSetChanged();

}

});

}

public void onClick(View view) {

DatePicker datePicker = (DatePicker) dialogView.findViewById=(R.id.date_picker);

TimePicker timePicker = (TimePicker) dialogView.findViewById(R.id.time_picker);

Calendar calendar = new GregorianCalendar(datePicker.getYear(),

datePicker.getMonth(),

datePicker.getDayOfMonth(),

timePicker.getCurrentHour(),

timePicker.getCurrentMinute());

time = calendar.getTimeInMillis();

alertDialog.dismiss();

}});

alertDialog.setView(dialogView);

alertDialog.show();

public class HW4 extends Activity {

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_hw4);

}

}

}

THERE ARE ERRORS IN THE JAVA CODE. PLEASE CORRECT ALL ERRORS IN THE CODE ABOVE.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students explore these related Databases questions