Cursor cursor = getContentResolver().query(Calls.CONTENT_URI,
new String[] { , , },
null,
null,
Calls.DEFAULT_SORT_ORDER);
(cursor);
boolean hasRecord = ();
long incoming = 0L;
long outgoing = 0L;
int count = 0;
while (hasRecord) {
int type = (());
long duration = (());
switch (type) {
case Calls.INCOMING_TYPE:
incoming += duration;
break;
case Calls.OUTGOING_TYPE:
outgoing += duration;
default:
break;
}
count++;
hasRecord = ();
}
(,
"Total " + count + "several calls. Total call duration " + (incoming + outgoing) + "seconds. Where answering " + incoming + " seconds, tapping "
+ outgoing + "seconds.",
Toast.LENGTH_LONG).show();