-2

Inside my fragment in the onCreateView method, I retrieve the Bundle which was set for the fragment using the following code:

Bundle args = getArguments();
String value = args.getString("fixedExpenseId");

But somehow the value is null when I run my code.

When I debug my program I retrieve the following variables:

Image of debug results

As you kan see, the key I used is the same as the one inside the Bundle.

How is it possible that I retrieve null inside my

value

variable?

michel
  • 97
  • 2
  • 6

2 Answers2

2

Just looking at the screenshot, it looks like you switched the key and value variables. You set the key "2" to "fixedExpenseId", and not the key "fixedExpenseId" to "2".

npace
  • 4,218
  • 1
  • 25
  • 35
1

I had the same problem. Just check that you are putting right value in bundle with right key i.e. in your case fixedExpenseId.

Jonas Czech
  • 12,018
  • 6
  • 44
  • 65
BMM
  • 161
  • 1
  • 1
  • 12