On Thursday, February 16, 2012 12:05:31 AM UTC-8, Subba wrote:
>
> @Lew -
>
> I changed the set values using static method rather than using
> instance method. It does't work.
>
> It's something do with Java version compatibility in ICS vs. GB. First
> of all i see difference in Object it's self comparing ICS to GB.
>
> I mentioned that I don't know why you needed to change the constructor.
The problem
with instance-level writes to static variables is orthogonal.
Your code that you show doesn't look wrong. Therefore I conclude the
problem is in the code that you didn't show.
Since the code you showed conforms to the API documentation, then there
aren't differences between ICS and Gingerbread at play here. So, no, that's
not where your problem is.
See the below code
>
> Lew wrote:
> > I don't know why you needed to change the constructor, but I'm quite
> sure
> > that
> > you shouldn't use an instance method to set values in a static variable.
> >
> > Subba wrote:
> > > My application uses Java BitSet API, i never had problem with in
> > > Android Ginger Bread and below version. All of sudden Android Ice
> > > Cream Sandwich, it giving wrong results.
> >
> > > code:
> >
> > > public class BitTracker
> > > {
> > > private static BitSet m_FileIds = new BitSet(65535);
> >
> > > private void init()
> > > {
> > > for(int i=0; i<=63; i++)
> > > {
> > > m_FileIds.set(i);
> > > }
> > > }
> >
> > > public int GetUnUsedId()
> > > {
> > > int iUnusedId = m_FileIds.nextClearBit(1);
> >
> > > return iUnusedId;
> > > }
> > > }
> >
> > > BitTracker tracker = new BitTracker();
> > > tracker.init();
> > > int unusedID = tracker.GetUnUsedId();
> >
> > > //In ICS unusedID returns "65536"
> >
> > > //In GingerBread unusedID returns "64"
> >
> > > I am able to fix the issue by changing this line
> >
> > > private static BitSet m_FileIds = new BitSet(65535); //old one
> >
> > > private static BitSet m_FileIds = new BitSet(); //new one
> >
> > > It seems to be working. I still can't understand what's deal with ICS
> > > vs. GingerBread.. Is there any Java compatible version difference in
> > > android ICS vs. GB or below versions..Curious to know..
--
Lew
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en