Android
OA0-002 · Question #68
Which of these is the correct code to create a Bitmap object using the file res/drawable/image.png?
The correct answer is B. Bitmap img = BitmapFactory.decodeResource(R.drawable.image). See the full explanation below for the reasoning.
Question
Which of these is the correct code to create a Bitmap object using the file res/drawable/image.png?
Options
- ABitmap img = BitmapFactory.decodeFile(R.drawable.image),
- BBitmap img = BitmapFactory.decodeResource(R.drawable.image);
- CBitmap img = new Bitmap(R.drawable.image);
- DBitmap img = (Bitmap)GraphicsFactory.decodeResouces(R.drawable.image);
How the community answered
(42 responses)- A2% (1)
- B86% (36)
- C7% (3)
- D5% (2)
Community Discussion
No community discussion yet for this question.