CallLog not giving the correct NUMBER value (Number dialled)
<p>I'm using <code>CallLog</code>, and setting one of my variables to the <code>CACHED_NAME</code> of the contact who the user dialled. This works fine, but in the event that the user dials a number which is not in their contacts I would like it to instead set the variable to the <code>NUMBER</code> value. For some reason when I do this I get results as single digit integers, such as "1" or "7". Here is my code:</p>

<pre><code>Uri allCalls = Uri.parse("content://call_log/calls");
    String sortOrder = CallLog.Calls.DATE;
    Cursor c = managedQuery(allCalls, null, null, null, sortOrder);

    while (c.moveToNext()) {

        int callType = Integer.parseInt(c.getString(c
                .getColumnIndex(CallLog.Calls.TYPE)));
        long date = c.getLong(c.getColumnIndex(Calls.DATE));
        String col1;

        if (callType == CallLog.Calls.OUTGOING_TYPE
                &amp;&amp; date &gt; resetDate) {

                col1 = c.getString(c.getColumnIndex(Calls.CACHED_NAME));
                // if there is no cached name, get the number
                if (col1 == null) {
                    col1 = String.valueOf(c.getLong(c
                            .getColumnIndex(Calls.NUMBER)));
                }
</code></pre>

<p>Am I right in saying that the value for <code>NUMBER</code> should be the phone number that the user dialled? I know that everything is correct except for the last line where I set <code>col1</code> to the number value. Any ideas?</p>
