Thursday, February 16, 2012

[android-developers] Re: Android "java.util.BitSet" in ICS vs "Ginger Bread"

@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.

See the below code

On Feb 15, 11:21 pm, Lew <lewbl...@gmail.com> 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.
>
> --
> Lew
>
>
>
>
>
>
>
> On Wednesday, February 15, 2012 10:27:05 PM UTC-8, 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..

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate