Hello everyone, I need to take parameter id = 55 from this picture, does anyone know how to do that? Thanks!!
System.out.println(voznja.toString());
When I try to log in console, I always get the error that object reference is null.
Hello everyone, I need to take parameter id = 55 from this picture, does anyone know how to do that? Thanks!!
System.out.println(voznja.toString());
When I try to log in console, I always get the error that object reference is null.
When you call extras.getString("voznja")
it returns null because voznja
is not a String
. Its class is Voznja
so you have to write your code like this:
Voznja voznja = (Voznja) extras.getSerializableExtra("voznja");
Now you can get the id by this line:
voznja.get("id");
I think that the id you are trying to read is in an object.
I would first suggest using :
voznja = extras.getSerializableExtra("voznja")
Then, I would use this to extract the id from the object :
voznja.get(0);
let me know if that helps
If your class implements Parcelable use:
Voznja voznja = extras.getParcelableExtra("voznja");
And if it implements Serializable use:
Voznja voznja = extras.getSerializableExtra("voznja");
And then you could get the id from your object.