Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8974897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:45:45+00:00 2026-06-15T18:45:45+00:00

I am working on an application, where i need to fetch 5 recently dialled

  • 0

I am working on an application, where i need to fetch 5 recently dialled numbers. I am able to sort the numbers in descending order, so as the recently dialled numbers comes first. I am using the following code to fetch the recent numbers.

dialledCall = (TextView)findViewById(R.id.dialledCall);

              String strOrder = CallLog.Calls.DATE + " DESC";
              Cursor mCallCursor = getApplicationContext().getContentResolver().query(CallLog.Calls.CONTENT_URI,
                      null,
                      CallLog.Calls.TYPE 
                      ,null,
                      strOrder);
              mCallCursor.moveToFirst();
              do {
                  if( i >5 )
                      break;
                  mobileNumber =   mCallCursor.getString(mCallCursor.getColumnIndex(android.provider.CallLog.Calls.NUMBER));
              number += mobileNumber + "\n";

              i++;
              }
              while (mCallCursor.moveToNext());
         dialledCall.setText(number);

With this, i am able to sort the numbers in recent order and also i have just fetched last 5 numbers. But the query returns all the numbers, i mean Dialled, Missed and Received as well. But here i want just the dialled numbers.

I know there is something to do with CallLog.Calls.TYPE in the above query.

I have tried passing null value, but it returns all the numbers.

I also have tried CallLog.Calls.OUTGOING_TYPE in place of it, but it gives error that int value is not permitted, it should be a string value.

Any suggestions on how to replace the above code, so as to only get the dialled calls.

Note- I have already looked at https://stackoverflow.com/a/10480569/1626878, but it does not provide a solution to only fetch the dialled numbers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:45:46+00:00Added an answer on June 15, 2026 at 6:45 pm

    I have solved the issue, so I am posting it for future visitors.

        String mobileNumber="";
        int i = 1;
        String number = "";
        TextView dialledCall;
            @Override
            public void onCreate(Bundle savedInstanceState)
            {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                dialledCall = (TextView)findViewById(R.id.dialledCall);
    
        //              String[] strFields = { android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.CACHED_NAME,         android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.DURATION     };
                      String strOrder = CallLog.Calls.DATE + " DESC";
                      Cursor mCallCursor = getApplicationContext().getContentResolver().query(CallLog.Calls.CONTENT_URI,
                              null,
                              CallLog.Calls.TYPE + " = " + CallLog.Calls.OUTGOING_TYPE
                              ,null,
                              strOrder);
                      mCallCursor.moveToFirst();
                      do {
                          if( i >5 )
                              break;
                          mobileNumber =   mCallCursor.getString(mCallCursor.getColumnIndex(android.provider.CallLog.Calls.NUMBER));
                      number += mobileNumber + "\n";
    
                      i++;
                      }
                      while (mCallCursor.moveToNext());
                 dialledCall.setText(number);
            }
    

    Here CallLog.Calls.TYPE + " = " + CallLog.Calls.OUTGOING_TYPE in the query separates out the dialled calls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an application in which i need to fetch all the
I need to make an HTTPS request from my application in order to fetch
I am working on business analytics application, where I need to fetch some data
I am working on an application in which i need to fetch all the
I am working on an application where I need to fetch all the videos
I am working on an application where I need to integrate the social functionality
I am working on an application where I need to integrate the social functionality
I am working on an application where I need to integrate the search engine.
I am working on an application where i need to place a uiscrollview within
I am currently working in an application where I need to find all occurrences

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.