Question: The code below resides in an activity with a context menu. myViews is a list of 4 View objects. Suppose the user activates the context

The code below resides in an activity with a context menu. myViews is a list of 4 View objects. Suppose the user activates the context menu for myViews[3]. What is x assigned?
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
...
for
(
i
in
0
until
4
)
{
registerForContextMenu
(
myViews
[
i
]);
myViews
[
i
].
tag
=
i
*
2
}
}
@Override
override
fun
onCreateContextMenu
(
menu
:
ContextMenu
?,
v
:
View
?,
menuInfo
:
ContextMenuInfo
?)
{
val
x
=
v
?.
tag
as
Int
...
}
Question 9 options:
2
3
4
6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!