Answer the question
In order to leave comments, you need to log in
How to get null value of Integer class?
I need to pass an Integer type value to another activity, which should be Null by default, but in get ... Extra, there is only getIntExtra which can only get primitive values, without Null. Subject. How do I get my null? If in the default value I should at least insert null.
MainActivity.uris.set(intent.getIntExtra("ids",null), urisis);
Answer the question
In order to leave comments, you need to log in
Integer is Serializable. Therefore, if you want to transmit in this way, then getIntent().getSerializableExtra()
help you. Only on getting, check for null before casting.
But if I were you, I would pass a primitive type, and instead of null, for example, use the default value -1.
It's a little trickier to use Parcelable.
There is more code to write, but complex objects can be transferred.
public class Ride implements Parcelable { ....}
Intent intent = new Intent(context, ReportActivity.class);
intent.putExtra(Ride.class.getCanonicalName(), ride);
context.startActivity(intent);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question