Try to divide by zero and catch the exception, then log it.
Logging in Android
Try-catch and logging
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
Log.e("MyApp", "exception", e) // Logging the exception
try {
} catch (e: ArithmeticException) {
val result = 10 / 0 // This will throw an exception
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.