ASSOCIATE-ANDROID-DEVELOPER practice question 3 of 25

What is a correct part of an Implicit Intent for sharing data implementation?

Full set: 128 questions
Answer options
A: val sendIntent = Intent(this, UploadService::class.java).apply { putExtra(Intent.EXTRA_TEXT, textMessage) ...
B: val sendIntent = Intent().apply { type = Intent.ACTION_SEND; ...
C: val sendIntent = Intent(this, UploadService::class.java).apply { data = Uri.parse(fileUrl) ...
D: val sendIntent = Intent().apply { action = Intent.ACTION_SEND ... Correct answer
Correct Answer:
D. val sendIntent = Intent().apply { action = Intent.ACTION_SEND ...
Explanation

Create the text message with a string val sendIntent = Intent().apply { action = Intent.ACTION_SEND putExtra(Intent.EXTRA_TEXT, textMessage) type = "text/plain"
}
Reference: https://developer.android.com/guide/components/fundamentals

Scroll to Top