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

  • SEARCH
  • Home
  • 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 7634475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:11:09+00:00 2026-05-31T07:11:09+00:00

I am retrieving the outgoing number from the broadcast receiver and trying to send

  • 0

I am retrieving the outgoing number from the broadcast receiver and trying to send it to the activity thru a method getNumber() however the value is coming out null. Im my code below In the activity class the String phonenumber is null

BroadcastReciever Class:

public class OutgoingBroadcastReceiver extends BroadcastReceiver {

String phonenumber = null;

@Override
public void onReceive(Context context, Intent intent) {


     phonenumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
  if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL"))
    {


         Log.i("System out", "IN OUTGOING CALL......... :IF");
         MyPhoneStateListener phoneListener = new MyPhoneStateListener(
                     context);
             TelephonyManager telephony = (TelephonyManager) context
                     .getSystemService(Context.TELEPHONY_SERVICE);
             telephony.listen(phoneListener,
                     PhoneStateListener.LISTEN_CALL_STATE);
     }    else {         
             Log.i("System out", "IN INCOMING CALL.........:else:receiver");           




}
public String getNumber()
{
    return phonenumber;
}

Activity Class:

public class OutgoingCallScreenDisplay extends Activity

{

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
    setContentView(R.layout.outgoing_main);
    OutgoingBroadcastReceiver outreciever = new  OutgoingBroadcastReceiver();

    String phonenumber= outreciever.getNumber();//this is coming out NULL needs to be the outgoing number






}
  • 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-31T07:11:11+00:00Added an answer on May 31, 2026 at 7:11 am

    Phone no. is null because u r making a new instance of broadcastreceiver whose values are not initilized. You can receive a phone no. in “onReceive” ONLY ,from there u should start a new activity if u want to pass it further

    See:

    Firstly you shud either use a broadcast receiver or a phone state listener. In ur case if u r using a broadcast receiver then u simple need intent extra:EXTRA_PHONE_NUMBER
    and permission : process outgoin call .That’s it…..

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

Sidebar

Related Questions

I am retrieving a fetch from my core data database and trying to iterate
If I am retrieving a value from a database which could be Null ,
We are retrieving the long lived access token from facebook fine, however we need
I am retrieving a jpg file from an oracle db, and trying to output
My method of programmatically retrieving e-mail addresses from the Address Book no longer seems
I am retrieving number of values from database, that need to be added to
Retrieving a value from standardUserDefaults using integerForKey after saving with setInteger:forKey always crashes app.
When retrieving a lookup code value from a table, some folks do this... Dim
I am retrieving a product description value stored in database from admin through textarea
I'm retrieving data from a MySQL table and displaying it on a webpage using

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.