2012-06-29 3 views
-2

나는 서버에서 데이터를 가져 와서지도에 표시하는 앱을 개발 중입니다. 하지만지도의 풍선에 표시하기 전에 하나의 필드 이름별로 데이터를 정렬하고 "목적지"를 만들고 방법이 없습니다. 전자는 ..GOTOSORT ...정렬 데이터 문제

이제 문제가 있습니다. 길이가 1 인 변수가 s입니다. 거기에 대한 루프 1 회를 실행하지만, 그래서 그것을 확인하고

private void GOTOSORT() { 

     Log.i(TAG, " SORT "); 
     Map<Float, Integer> map = new TreeMap<Float, Integer>(); 

     for (int i = 0; i < lng_timeStamp.length; ++i) { 
      map.put((float) lng_timeStamp[i], i); 
     } 
     Collection<Integer> indices = map.values(); 
     System.out.println("indices" + indices); 
     Integer s[] = (Integer[]) indices.toArray(new Integer[0]); 

     Log.i(TAG, "s.length"+s.length); 
     for (int i = 0, n = s.length; i < n; i++) { 
      System.out.println(s[i]); 

      int_sort_MyhourGetTime[i] = int_MyhourGetTime[s[i]]; 
      int_sort_MyMinGetTime[i] = int_MyMinGetTime[s[i]]; 
      lng_sor_timeStamp[i] = lng_timeStamp[s[i]]; 
      arr_sort_ServiceNumber[i] = arr_ServiceNumber[s[i]]; 
      arr_sort_Destination[i] = arr_Destination[s[i]]; 

     } 
+0

사용'indices.size();'적 루프 –

+0

년에 내가 인쇄 인덱스 크기가 나에게 여기에 어떤 영향 –

+0

을받지하고 그 다음 나에게 1 –

답변

1

당신이 당신의 목록을 정렬 할 경우 수행해야 할 문제가 무엇인지 말씀 해주십시오 웹 서비스에서 제공하는 42 개 데이터가된다 자바의 비교 자 Follow here 정렬 순서에 상관없이 정렬 된 목록을 반환합니다.

모두 최고! :)