Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Android Exam AND-801 Topic 4 Question 81 Discussion

Actual exam question for Android's AND-801 exam
Question #: 81
Topic #: 4
[All AND-801 Questions]

You have an Android application that consists of two activities (MainActivity and SecondActivity) and you want to pass data in text field (ID: FirstNameJD) of MainAcitivity to SecondActivity. The passed data will appear in SecondActivity inside a TextView widget with Id: HelloMessageJD. You will use Intent to pass this data from MainActivity to SecondActivity. The Following two images include the Android code which will be written in MainActivity.kt and SecondActivity.kt files. Your data will not pass from MainActivity to SecondActivity due to a mistake in the code in SecodActivity.kt. Which of the following choices is a correct solution to make this app run correctly?

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Brendan
5 days ago
I'm not sure about that. I think we need to add an if statement to solve this issue in both files.
upvoted 0 times
...
Holley
6 days ago
The issue here is that the data is being passed incorrectly in the SecondActivity.kt file. The correct solution is to use `getStringExtra(name)` instead of `putSiringExtra(name)`. This will ensure that the data is properly passed from the MainActivity to the SecondActivity.
upvoted 0 times
...
Rosalind
9 days ago
I agree with Ranee. That seems like the right fix to make the data pass correctly from MainActivity to SecondActivity.
upvoted 0 times
...
Ranee
11 days ago
I think the correct solution is to replace getStringExtra(\'name\') with putStringExtra(\'name\') in SecondActivity.kt file.
upvoted 0 times
...

Save Cancel