The easiest way to sort and work with files in general is the Commons
IO API:

http://commons.apache.org/io/

On Jul 25, 6:56 am, greg <[email protected]> wrote:
> Thanks Tom.  I'll add the explicit sort.
>
> - greg
>
> On Jul 24, 6:19 pm, Tom Gibara <[email protected]> wrote:
>
>
>
> > From the Sun/Oracle javadocs:
>
> > There is no guarantee that the name strings in the resulting array will
>
> > > appear in any specific order; they are not, in particular, guaranteed to
> > > appear in alphabetical order.
>
> > Tom.
>
> > --
> > Tom Gibara
> > email: [email protected]
> > web:http://www.tomgibara.com
> > blog:http://blog.tomgibara.com
> > twitter: tomgibara
>
> > On 24 July 2010 22:12, greg <[email protected]> wrote:
>
> > > I don't see anything about this change in the API differences report
> > > athttp://developer.android.com/sdk/api_diff/8/changes.html.  However
> > > when my Nexus One started running Android 2.2, the list of files
> > > created by the following code are now in reverse alphabetical order
> > > rather than alphabetical order (as they were with Android 2.1 and
> > > earlier, AFAIK):
>
> > >   File fileDir = new File(strSomePathToSDCardDirectory);
> > >   String fn[] = fileDir.list();
>
> > > The line "Arrays.sort(fn);" revives the alphabetical order of the
> > > list, but sorts are computationally expensive and AFAIK the explicit
> > > call to Arrays.sort() was unnecessary prior to Android 2.2.
>
> > > Was this change intentional?
>
> > > - greg
>
> > > P.S., In addition to seeing this order change on the Nexus One, it can
> > > be confirmed on the emulator running level 7 and level 8 AVDs.
>
> > > --
> > > 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]<android-developers%2bunsubs­[email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en- Hide quoted text -
>
> - Show quoted text -

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

Reply via email to