Convert Object to int

This is returning an object and is looking for a type int; this.memberId = this.context.getPrimaryKey();how do i convert an object to an int?
[169 byte] By [justinwalker80a] at [2007-9-30 0:40:13]
# 1

The objet must be an Integer.

this.memberId = this.context.getPrimaryKey();

Integer objectInteger = (Integer) this.memberId;

int counter = objectInteger.intValue();

That's all. Good Luck.

--

Convert Object to int

Author: justinwalker80 Feb 18, 2004 12:13 PM

This is returning an object and is looking for a type int;

this.memberId = this.context.getPrimaryKey();

how do i convert an object to an int?

restaliona at 2007-7-16 5:12:00 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 2
> how do i convert an object to an int?You can't. Most likely the method returns an Integer object. Check your API how to extract aprimitive int value from such an object.kind regards,Jos
JosHorsmeiera at 2007-7-16 5:12:00 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 3
You can always get the Object's hashCode.That might not be very interesting or useful in this context, but it IS an int. :-)MOD
duffymoa at 2007-7-16 5:12:00 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 4
this.memberId = Integer.parseInt((String)this.context.getPrimaryKey());
benjamin.podolla at 2007-7-16 5:12:00 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...