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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:23:10+00:00 2026-05-27T21:23:10+00:00

I am doing one application in android for that I need to access com.android.internal.telephony

  • 0

I am doing one application in android for that I need to access com.android.internal.telephony APIs. Now I am able to access those APIs but problem is wherever I call the getEarliestConnection() method of Class Call.java in my own class it’s throwing a NullPointerException.
You can find Call.java here http://hi-android.info/src/com/android/internal/telephony/Call.java.html. In this class there is the following method:

1.    public Connection
2.        getEarliestConnection() {
3.            List l;
4.            long time = Long.MAX_VALUE;
5.            Connection c;
6.            Connection earliest = null;
7.    
8.            l = getConnections();
9.  
10.            if (l.size() == 0) {
11.                return null;
12.            }

        for (int i = 0, s = l.size() ; i < s ; i++) {
            c = (Connection) l.get(i);
            long t;

            t = c.getCreateTime();

            if (t < time) {
                earliest = c;
                time = t;
            }
        }

        return earliest;
    }

I want to call this method in my class. the class Call.java ia an abstract class I created subclass of Call class and called the above method like this:

Call myCall = new MyCall();
Connection myConn = new MyConn();
myConn = myCall.getEarliestConnection();  

But It’s throwing a NullPointerException on line no:10 of above method and line no:3 of above code.

  • 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-27T21:23:10+00:00Added an answer on May 27, 2026 at 9:23 pm

    Obviously getConnections() returns null here and you cannot get the size of the null-object.

    Here’s how to fix it:

    if (l == null || l.size() == 0) 
    {
        return null;
    }
    

    So, if for some unknown reason, there is no Connection-List or the list is empty, null will be returned. Using the operator || will do the same as

    if (l == null)
    {
        return null;
    }
    else if ( l.size() == 0)
    {
        return null;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing one android application, for that I used com.android.internal API's. They are
Been doing some Android permission research and ran across an application that - according
I know that android doesn't highlight anything in TouchMode. But I am doing something
I'm developing an application for Android tablet 3.0 that has one activity that should
i am doing one small application , wheich have login functionality, in the user
I'm doing an asp.net application with one page. In this page, I have one
I am doing a C# application targeting WinXP, Vista, and 7 Operating Systems. One
I can disable one and one by doing this: jQuery('#ListBoxA').attr('disabled','true'); But how can I
Some people have suggested that when doing an estimate one should make a lower
I have an Android application with a main activity that is the tabhost. I'm

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.