Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Android

 
jayna gandhi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am new in Android. Can anybody please help me how to sort an array in Android.
I have an array for string which contains repetative values and I want to sort it. In iPhone we have NSDescriptor for that so which function is there in Android for that.
Thanks in advance
 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sort it just like you sort it in core java.
 
Ankit Vyas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!Jayna

i have give you one example.

// String[] myArray = new String[] {"foo","bar","baz"};
//java.util.Arrays.sort(myArray); //WARNING, destructive operation

using this you will get you task completed.
for more detail please refer this link
http://www.rgagnon.com/javadetails/java-0343.html
 
Rob Spoor
Sheriff
Pie
Posts: 20744
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Android SDK (available at http://developer.android.com/reference/packages.html) includes many classes and interfaces from the Java SE API. You can use these just as you would in a non-Android Java program. In this case, Arrays.sort as suggested by Ankit should work just fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic