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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:23:34+00:00 2026-06-10T00:23:34+00:00

I want to simply call one function that is defined in BroadClass Activity from

  • 0

I want to simply call one function that is defined in BroadClass Activity from my AlarmManager Activity. For this I have made one broadcast Receiver and i am triggering it from Alarmmanager Activity , but I am getting no response

AlarmManager Activity ( TRIGGERING Broadcast from here)

 package com.mainActivity;

    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;

    public class AlarmManagerActivity extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            Intent intent = new Intent(AlarmManagerActivity.this,BroadClass.class);
            intent.setAction("BROADCAST_ACTION");
            sendBroadcast(intent);
    }
    }

BroadClass Activity where I have defined the Broadcast Reciever

   package com.mainActivity;


    import android.app.Activity;
    import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    import android.content.IntentFilter;
    import android.os.Bundle;
    import android.widget.Toast;



    public class BroadClass extends Activity {

        public BroadcastReceiver broadCast;

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);



            registerReceiver(new BroadcastReceiver() {

                @Override
                public void onReceive(Context arg0, Intent arg1) {
                    // TODO Auto-generated method stub

                    Toast.makeText(BroadClass.this, "SDK Manager Activity", Toast.LENGTH_SHORT).show();


myFunction();   //which i want to call

                }
            },new IntentFilter("BROADCAST_ACTION"));


        }


        @Override
        protected void onResume() {
            // TODO Auto-generated method stub
            IntentFilter filter = new IntentFilter();
            filter.addAction("BROADCAST_ACTION");
            registerReceiver(broadCast, filter);

            super.onResume();


        }

public void myFunction(){

//mycode here

    }

Kindly Help me..
Thanks in advance

  • 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-10T00:23:35+00:00Added an answer on June 10, 2026 at 12:23 am

    Have you tried removing the BroadcastReceiver setup in onResume? You’re registering a new broadcastreceiver with an empty IntentFilter.

    Remember, onResume is always run after onCreate, and in your case resetting the filter that was initially set.

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

Sidebar

Related Questions

Let's say I have an interface IMyInterface<T> that simply describes one function: public interface
I simply want to fill-up cells in my spreadsheet from a VBA function. By
I simply want to generate a class with attributes that comes from a Database
I have a view that contains a javascript function that i need to init/call
I want to create a simple menu function which can call it example get_menu()
I simply want to post an image and comment from my own site to
I simply want to show off a model in a table that is paginated
I simply want to change a variable of an object from another class. I
I simply want to return all rows from a users table but selected fields,
I have an HTML select list (let's call it List A) that is dynamically

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.