Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA CODE: 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; public class MainActivity extends AppCompatActivity

JAVA CODE:

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;

public class MainActivity extends AppCompatActivity

{

@Override protected void onCreate (Bundle savedInstanceState)

{

super.onCreate (savedInstanceState);

setContentView (R.layout.activity_main);

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_main);

final ProgressBar simpleProgressBar =

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

simpleProgressBar.setOnClickListener ();

}

@Override protected void onCreate (Bundle savedInstanceState)

{

super.onCreate (savedInstanceState);

setContentView (R.layout.activity_main);

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

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

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

arrayList = new ArrayList ("Road", "Track", "Gravel", "Other");

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 ();

}

}

-------------------------------------------------------------------------------------------

GIVEN THE JAVA CODE ABOVE CORRECT ALL ERRORS IN THE XML CODE PROVIDED BELOW

XML CODE:

xml version="1.0" encoding="utf-8"?>

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

Step: 3

blur-text-image

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions