H
H
HolidayR2018-07-31 10:48:11
Java
HolidayR, 2018-07-31 10:48:11

What is the reason for getting default value on Intent?

I'm trying to pass an int value from one class to another, but the value is not passed, and the default value is assigned.
The class from which we send the int value

Intent myIntent = new Intent(this, B.class);
        myIntent.putExtra("level", level);

The class that should receive the int value
int level = getActivity().getIntent().getIntExtra("level", 0)

What could be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2018-07-31
@klim76

What could be wrong?

for example, that the level variable is not int

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question