Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with CallLog
    primarykey
    data
    text
    <p>I am trying to add durations of all calls in current month. I am comparing the month of mobile time with month of call to add calls in current month. But dates of calls is returning 1. I am tried to get full dates and it is ever 1.1.1970.(Yes, I checked date of calls and its right 4.4.2011)</p> <p>Source code:</p> <pre><code> DateFormat date = new SimpleDateFormat("MM"); Calendar calendar = Calendar.getInstance(); long currentDate = calendar.getTimeInMillis(); String currentDatess = date.format(currentDate); int d1 = Integer.valueOf(currentDatess.toString()); Log.d(TAG,"Value od d1: " + d1); **-&gt;&gt; it is returning right value(now 4)** Cursor cCall = getContentResolver().query(android.provider.CallLog.Calls.CONTENT_URI, null, null, null, null"); while(cCall.moveToNext()){ CallsDuration = cCall.getColumnIndex(android.provider.CallLog.Calls.DURATION); CallDateFull = cCall.getColumnIndex(android.provider.CallLog.Calls.DATE); calendar.setTimeInMillis(CallDateFull); String datess = date.format(calendar.getTime()); datesss = Integer.valueOf(datess.toString()); String callDate = DateFormat.getDateInstance().format(CallDateFull); **-&gt; only for test,it is ever returning 1.1.1970** Log.d(TAG, "Test: " + callDate); totalTimeInInt = totalTimeInInt + CallsDuration; **--&gt; Total duration time of all calls** Log.d(TAG, "Date: " + datesss); --&gt; this is returning 1(1.1.1970) if (d1 == datesss){ CallsInMonth = CallsInMonth + CallsDuration; } } TotalTime = String.valueOf(totalTimeInInt); CallInMonthString = String.valueOf(CallsInMonth); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload