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 7641173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:51:26+00:00 2026-05-31T08:51:26+00:00

I am in the phase of developing an application on call logs. Before i

  • 0

I am in the phase of developing an application on call logs. Before i dive into it I would want to get some information on this as I have read through the call logs class in Android Developer.

I want to know if there is a way that I can sort the call logs and sms and extract only international and local(Also the same with sms). Is it also possible that I accomplish this task by using third party Library like the Libphonenumber? If anyone has any code and suggestion that will help me I will be most grateful. I would appreciate a solution in the form of code or an advice on how i can accomplish this. I really do not want to get stuck half way when i start working on the project

This is the code I have to get the call logs for only outgoing calls

    managedCursor = managedQuery( CallLog.Calls.CONTENT_URI,null, null,null, null);
    int number = managedCursor.getColumnIndex( CallLog.Calls.NUMBER ); 
    int type = managedCursor.getColumnIndex( CallLog.Calls.TYPE );
    int date = managedCursor.getColumnIndex( CallLog.Calls.DATE);
    int duration = managedCursor.getColumnIndex( CallLog.Calls.DURATION);


    while ( managedCursor.moveToNext() ) {

    String phNumber = managedCursor.getString( number );

    String callType = managedCursor.getString( type );
    String callDate = managedCursor.getString( date );
    Date callDayTime = new Date(Long.valueOf(callDate));
    String callDuration = managedCursor.getString( duration );

    int realdura=Integer.parseInt(callDuration);

    String dir = null;
    int dircode = Integer.parseInt( callType );
    if(dircode==CallLog.Calls.OUTGOING_TYPE){
        dir="OutGoing Call";

    total_duration=realdura+total_duration;
    callList=("\nPhone Number:--- "+phNumber +" \nCall Type:--- "+dir+" \nCall Date:--- "+callDayTime+" \nCall duration in sec :--- "+callDuration);

    data.add(callList);
    }
    }

    managedCursor.close();

    call.setText("the total duration is: "+total_duration);
    list_data=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,data);
    call_list.setAdapter(list_data);
    }
  • 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-05-31T08:51:27+00:00Added an answer on May 31, 2026 at 8:51 am

    Using libphonenumber would seem to be a good idea to make things work internationally, there’s a lot of country specifics in how they are represented.

    What you need is the call PhoneNumberUtil.parse (which I can’t seem to link directly to), and pick the country_code out of the resulting PhoneNumber (documented here in the example) That should allow you to just compare the country code to your local country code and easily know whether the call is international.

    Here’s a quick and dirty example (without error handling), “SE” is Sweden with international calling code “00” and country code “46” (ie the number is domestic and outputs that)

    public static void main(String[] argv) throws NumberParseException {
        String str = "00468328999298";
    
        PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
    
        Phonenumber.PhoneNumber number = phoneNumberUtil.parse(str, "SE");
        if(number.getCountryCode() != phoneNumberUtil.getCountryCodeForRegion("SE"))
            System.out.println("International");
        else
            System.out.println("Domestic");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a website which is currently in testing phase. Whenever I make some
We are currently in pre phase of developing a desktop application for windows. But
I am developing one application, right now i am on designing phase. i design
I am developing an application in which I am using HTML documents.Now I want
Optimizing a game we're developing, we're running into the phase where every CPU cycle
During production phase I would most probably look into migrate functionality (with versions and
I am developing an application that is supposed to have games, when one clicks
I am currently developing an maven based application. I want to make a bat
I'm in the planning phase for developing a web application and am trying to
I am developing an application using PHP in Aptana Studio 3, and have set

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.