2014-02-05 1 views
0

모든 통화 로그를 구문 분석하려고하지만 첫 번째 호출 만 끝나면 커서가 바운드됩니다. - 루프 동안, 나는 조건이 될 필요가 생각이 있기 때문에아웃 바운드 통화 인덱스 용 커서

if (c != null && c.getCount()>0) { 
     if (c.moveToFirst()) {! 
      type = Integer.parseInt(c.getString(c.getColumnIndex(CallLog.Calls.TYPE))); 
      do { 
       try{ 
        Log.d(this.getClass().getName(),"Date is "+c.getString(c.getColumnIndex(Calls.DATE))); 
       }catch(Exception e){ 
        Log.d(this.getClass().getName(),"Exception: DATE IS NULL!!"); 
       } 
      //String timestamp = c.getString(c.getColumnIndex(Calls.DATE)); 
       //Log.d(this.getClass().getName(),"timestamp is: "+timestamp); 
       try{ 
        long duration= c.getLong(c.getColumnIndex(CallLog.Calls.DURATION)); 
       }catch(Exception e){ 
        Log.d(this.getClass().getName(),"Exception: DURATION IS NULL!!"); 
       } 
       //callDuration.put(timestamp, duration); 
      } 
      while (!c.moveToNext()); 
     } 
    } 

답변

0

가 할 일이다 : 그것은

내 코드는 여기에 사전에

감사합니다 (날짜와 시간에 대한)이 개 예외를 throw 루프를 계속하려면 true입니다.

그래서 코드는

는 { 이 } 동안 (c.moveToNext()) 할 말을해야;

조건이 거짓이되면 루프가 종료됩니다.

설명은 여기입니다 - http://docs.oracle.com/javase/tutorial/java/nutsandbolts/while.html

관련 문제