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 AND-801 Exam - Topic 4 Question 81 Discussion

Posted by Deangelo on Feb 06, 2025 at 10:16 AM

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?

Suggested Answer: A

Get Premium AND-801 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
34 comments · newest first
LI
Lisbeth 10 months ago
Surprised there's a mistake in the code, thought it was straightforward!
MI
Mickie 11 months ago
Definitely not option B, that's a typo!
EL
Ellen 11 months ago
Wait, isn't it supposed to be putStringExtra instead of getStringExtra?
FR
Francine 11 months ago
I think option D is the right choice!
JU
Judy 11 months ago
You need to use getStringExtra to retrieve the data.
LO
Lorrie 12 months ago
I’m a bit confused about the putStringExtra and getStringExtra methods. I hope I don’t mix them up in the exam!
DO
Dona 12 months ago
I feel like adding an if statement might be overcomplicating things. I should double-check how to retrieve the data properly.
CH
Cherrie 12 months ago
I think I saw a similar question where we had to use getStringExtra correctly. Maybe replacing 'name' with 'pass' could be the right move?
SH
Shizue 1 year ago
I remember something about using Intent to pass data, but I'm not sure if I need to call startActivity in SecondActivity.
FI
Fidelia 1 year ago
This is a good test of my Android app development skills. I'll carefully consider each of the options and choose the one that best addresses the problem.
GR
Gracia 1 year ago
I'm feeling pretty confident about this one. The key is to make sure the intent is set up correctly in MainActivity.kt and that the data is being accessed properly in SecondActivity.kt.
TA
Tamesha 1 year ago
Okay, I think I've got this. The issue is likely in how the data is being retrieved in SecondActivity.kt. I'll try the different options and see which one works.
HA
Hayley 1 year ago
Hmm, I'm a bit confused by the question. I'll need to think through the process of passing data between activities and make sure I understand the correct syntax.
GE
German 1 year ago
This looks like a tricky question. I'll need to carefully review the code in the images to identify the mistake in SecondActivity.kt.
NI
Nilsa 1 year ago
This is a classic Android programming mistake. The solution is definitely B, replacing `getStringExtra(name)` with `putSiringExtra(name)`. Don't worry, we've all been there before!
CH
Cherelle 1 year ago
↳ replying to Nilsa
Thanks for the tip! I'll make sure to remember that for next time.
RO
Rosio 1 year ago
↳ replying to Nilsa
Yes, that's right! It's a common mistake to mix up those methods.
MO
Monroe 1 year ago
↳ replying to Nilsa
I think the correct solution is B) Replace getStringExtra(\'name\') with putSiringExtra( \'name\') in SecondActiy.kt file.
ER
Ernestine 1 year ago
Haha, looks like someone's having a hard time with their Android coding! Maybe they should try turning it off and on again? Just kidding, but seriously, the answer is B. It's a simple fix, just gotta watch those typos.
JO
Josefa 1 year ago
I think the answer is B. Replacing `getStringExtra(name)` with `putSiringExtra(name)` in the SecondActivity.kt file should fix the issue. It's a simple typo that's causing the problem.
AN
Annalee 1 year ago
↳ replying to Josefa
User 4: Adding startActivity(intent) to Secondryactivity.kt might be the solution to make the app run correctly.
WH
Whitney 1 year ago
↳ replying to Josefa
User 3: I believe the solution is D. Replace ''name'' with ''pass'' in intent.getSt4ingExtra( ''name'').
NA
Nan 1 year ago
↳ replying to Josefa
User 2: No, that's not correct. You need to add an if statement to solve this issue in the two files.
NA
Nancey 1 year ago
↳ replying to Josefa
User 1: I think the answer is B. Replacing `getStringExtra(name)` with `putSiringExtra(name)` in the SecondActivity.kt file should fix the issue. It's a simple typo that's causing the problem.
BR
Brendan 2 years ago
I'm not sure about that. I think we need to add an if statement to solve this issue in both files.
HO
Holley 2 years 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.
LI
Lindsey 1 year ago
↳ replying to Holley
Yes, that's the correct solution. By replacing 'name' with 'pass', the data will be passed correctly.
EL
Ellen 1 year ago
↳ replying to Holley
D) Replace ''name'' with ''pass'' in intent.getSt4ingExtra( ''name'')
TH
Theola 1 year ago
↳ replying to Holley
The correct solution is to use `getStringExtra(name)` instead of `putSiringExtra(name)`.
KA
Karina 1 year ago
↳ replying to Holley
B) Replace getStringExtra(\'name\') with putSiringExtra( \'name\') in SecondActiy.kt file
VI
Virgie 1 year ago
↳ replying to Holley
No, that's not the correct solution. You need to use getStringExtra instead of putSiringExtra.
RO
Rolande 1 year ago
↳ replying to Holley
B) Replace getStringExtra(\'name\') with putSiringExtra( \'name\') in SecondActiy.kt file
RO
Rosalind 2 years ago
I agree with Ranee. That seems like the right fix to make the data pass correctly from MainActivity to SecondActivity.
RA
Ranee 2 years ago
I think the correct solution is to replace getStringExtra(\'name\') with putStringExtra(\'name\') in SecondActivity.kt file.
0/2000 characters

Save Cancel