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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:33:41+00:00 2026-05-27T22:33:41+00:00

I am using com.android.internal.telephony API’s. In that I called two abstract classes they are

  • 0

I am using com.android.internal.telephony API’s. In that I called two abstract classes they are Call.java and Connection.java. You can find these classes here http://hi-android.info/src/com/android/internal/telephony/Call.java.html and http://hi-android.info/src/com/android/internal/telephony/Connection.java.html for these created subclasses like

Call myCall = new MyCall();
Connection myConn = new MyConnection();

I need to use getDisconnectCause method from connection class which is an abstract method, I used like this:

myConn = myCall.getEarliestConnection();                            
      if(myConn == null){
         System.out.println("myConn is null ******");   
        }else
           {
            Connection.DisconnectCause cause = myConn.getDisconnectCause();                      
                System.out.println("value of cause ******"+cause);  
           }

The subclass of Call.java is:

1.     CallManager cm = CallManager.getInstance();  
2.        Phone.State state;
3.    
4.        public List<Connection> getConnections() {    
5.         state = cm.getState();       
6.         ringingCall = cm.getForegroundCalls();    
7.         System.out.println("**inside getConnections="+state);    
8.         System.out.println("**inside getConnections="+ringingCall);  
9.           if ( ringingCall == null) {
10.               System.out.println("**call is null***");
11.               return emptyConnections;
12.            }
13.            else
14.            {
15.             System.out.println("**call is not null***");
16.                    return ((Call) ringingCall).getConnections();    
17.            }
18.                    @Override
19.                    public Phone getPhone() {
20.                     return null;
                    }
                   @Override
                   public void hangup() throws CallStateException {

                            }

                   @Override
                   public boolean isMultiparty() {
                    return false;
                   }        
                   public Connection
                       getEarliestConnection() {
                            List l;
                                long time = Long.MAX_VALUE;
                                Connection c;
                                Connection earliest = null;

     68.                        l = getConnections();

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

                                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;
                            }

                        }

AND the Connection.java subclass is:


    class MyConnection extends Connection{

            @Override
            public void cancelPostDial() {
                // TODO Auto-generated method stub

            }

            @Override
            public String getAddress() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public Call getCall() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public long getConnectTime() {
                // TODO Auto-generated method stub
                return 0;
            }

            @Override
            public long getCreateTime() {
                // TODO Auto-generated method stub
                return 0;
            }

            @Override
            public DisconnectCause getDisconnectCause() {
                // TODO Auto-generated method stub


                return null;
            }

            @Override
            public long getDisconnectTime() {
                // TODO Auto-generated method stub
                return 0;
            }

            @Override
            public long getDurationMillis() {
                // TODO Auto-generated method stub
                return 0;
            }

            @Override
            public long getHoldDurationMillis() {
                // TODO Auto-generated method stub
                return 0;
            }

            @Override
            public int getNumberPresentation() {
                // TODO Auto-generated method stub
                return 0;
            }

            @Override
            public PostDialState getPostDialState() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public String getRemainingPostDialString() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public UUSInfo getUUSInfo() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public void hangup() throws CallStateException {
                // TODO Auto-generated method stub

            }

            @Override
            public boolean isIncoming() {
                // TODO Auto-generated method stub
                return false;
            }

            @Override
            public void proceedAfterWaitChar() {
                // TODO Auto-generated method stub

            }

            @Override
            public void proceedAfterWildChar(String arg0) {
                // TODO Auto-generated method stub

            }

            @Override
            public void separate() throws CallStateException {
                // TODO Auto-generated method stub

            } 


        }  

EDIT 2 : I have edited line number 1 to 17. Plz check this. I am getting java.lang.ClassCastException: java.util.Collections error on Line No: 16 and Line No:68. Can anybody help me to resolve this. And also I am getting only one state of call i.e IDLE always even though the call is not-null . I am getting inside else part. plz help me.

  • 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-27T22:33:41+00:00Added an answer on May 27, 2026 at 10:33 pm
     @Override
     public List<Connection> getConnections() {
        return null;
     }
    

    This method on your MyCall class returns null and in your code for MyCall.getEarliestConnection(); it returns null if getConnections() returns null.

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

Sidebar

Related Questions

I'm using a COM object that has a function called GetImage. http://www.pdf-tools.com/asp/products.asp?name=P2IA When I
I have been using com.sun.org.apache.xpath.internal.XPathAPI for some time and it seems to work ok.
What are profound advantages that one get when using COM for developing components over
I've written a .NET DLL which is called from another application using COM interop.
Here's the core problem: I have a .NET application that is using COM interop
I am using a com DLL in the following manner: #Region API Function <DllImportAttribute(abc.dll,
I'm using the Audio Capture sample on android.com to record and play back audio
I'm using a Google API MapView in my Android application and I've discovered it
Been trying to call Preferences.java class using: Intent settingsActivity = new Intent(getBaseContext(), Preferences.class); startActivity(settingsActivity);
When using COM boolean values are to be passed as VARIANT_BOOL which is declared

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.