Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

- Complete Exercise 4-1 at the end of chapter 4 Test and debug the Tip Calculator app. This exercise will guide students through the process

- Complete Exercise 4-1 at the end of chapter 4 Test and debug the Tip Calculator app. This exercise will guide students through the process of using the Android ADT to test and debug an app. image text in transcribed

image text in transcribed

115 Chapter 4 How to test and debug an Android app Exercise 4-1 Test and debug the Tip Calculator app This exercise guides you through the process of using Android Studio to test and debug an app. Test the app with invalid data 1. Start Android Studio and open the project named ch04_exl_TipCalculator that's in this directory: murachlandroid\ex starts Run this project and test the app with a valid subtotal like 100. This should work correctly Test the app with an invalid subtotal by leaving the bill amount blank and pressing the Done key. This should cause the app to crash with a run-time error, and it should display an error message in the LogCat window. Study the error message that's displayed in red. You can focus on the first few lines of this message. These lines give information about the exception that caused the app to crash. Based on this information, you should be able to figure out that the app crashed because an empty string isn't a valid float value. 2. 3. 4. Fix the bug by using a try/catch statement to handle the exception. The catch clause for the exception should set the billAmount variable to zero 5. Use LogCat logging 6. At the end of the onCreate method, add a logging statement that prints 7. Add logging statements that print "onPause executed" and onResume 8. Run the app and view the logging statements as you change orientation. onCreate executed" to the LogCat window. executed" to the ends of the onPause and onResume methods. Note that this causes the onPause, onCreate, and onResume methods to be executed. This shows that the activity is destroyed and recreated when you change orientation. Run the app and view the logging statements as you navigate away from and back to the app. Note that this only causes the onPause and onResume methods to be executed. This shows that the activity is paused when you navigate away from it and resumed when you navigate back to it. 9, Test on different emulators 10. Create an emulator for a tablet. 1: Kun the app in that emulator. It should work as before Create an emulator for a phone with a hard keyboard and a DPad. un the app in that emulator. You should be able to use your computer's keyboard to 13 enter a bill amount and press the Enter key to submit this entry. 115 Chapter 4 How to test and debug an Android app Exercise 4-1 Test and debug the Tip Calculator app This exercise guides you through the process of using Android Studio to test and debug an app. Test the app with invalid data 1. Start Android Studio and open the project named ch04_exl_TipCalculator that's in this directory: murachlandroid\ex starts Run this project and test the app with a valid subtotal like 100. This should work correctly Test the app with an invalid subtotal by leaving the bill amount blank and pressing the Done key. This should cause the app to crash with a run-time error, and it should display an error message in the LogCat window. Study the error message that's displayed in red. You can focus on the first few lines of this message. These lines give information about the exception that caused the app to crash. Based on this information, you should be able to figure out that the app crashed because an empty string isn't a valid float value. 2. 3. 4. Fix the bug by using a try/catch statement to handle the exception. The catch clause for the exception should set the billAmount variable to zero 5. Use LogCat logging 6. At the end of the onCreate method, add a logging statement that prints 7. Add logging statements that print "onPause executed" and onResume 8. Run the app and view the logging statements as you change orientation. onCreate executed" to the LogCat window. executed" to the ends of the onPause and onResume methods. Note that this causes the onPause, onCreate, and onResume methods to be executed. This shows that the activity is destroyed and recreated when you change orientation. Run the app and view the logging statements as you navigate away from and back to the app. Note that this only causes the onPause and onResume methods to be executed. This shows that the activity is paused when you navigate away from it and resumed when you navigate back to it. 9, Test on different emulators 10. Create an emulator for a tablet. 1: Kun the app in that emulator. It should work as before Create an emulator for a phone with a hard keyboard and a DPad. un the app in that emulator. You should be able to use your computer's keyboard to 13 enter a bill amount and press the Enter key to submit this entry

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

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Write each number without exponents. (36/144) 1/2

Answered: 1 week ago

Question

How are members held accountable for serving in the assigned roles?

Answered: 1 week ago