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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:49:52+00:00 2026-05-30T21:49:52+00:00

I get Unable to resume activity RunTimeException and it obviously has to do with

  • 0

I get “Unable to resume activity” RunTimeException and it obviously has to do with my broadcastReciever (for bluetooth). onPause works well. But what’s wrong with this simple code?

//Class fields:
    boolean isReceiverRegistered = false; //My flag
    IntentFilter intentFilter = null;

//Inside onCreate:
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
        intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
    if (!isReceiverRegistered) {
        registerReceiver(intentReceiver, intentFilter);
        isReceiverRegistered = true;
    }


protected void onResume() {
    super.onResume();
    if (!isReceiverRegistered) {
        registerReceiver(intentReceiver, intentFilter); //THE CRASH STATEMENT
        isReceiverRegistered = true;
    }
}

protected void onPause() {
    super.onPause();
    if (isReceiverRegistered) {
        try {
            unregisterReceiver(intentReceiver);
        } catch (IllegalArgumentException e) {
        }
        isReceiverRegistered = false;
    }
}

BroadcastReceiver intentReceiver = new BroadcastReceiver() {
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
        if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) {
        Log.v(TAG, "connected:"+device.getName());
        }
        else if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
        Log.v(TAG, "disconnected:"+device.getName());
        }
    }
};
  • 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-30T21:49:53+00:00Added an answer on May 30, 2026 at 9:49 pm

    in onCreate you are create intentFilter but your class field intentFilter still null. Try
    in your onCreate:

         .....
        intentFilter = new IntentFilter();
        intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
        intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
          .....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm unable to get this jquery statement to work on page load but it
I am unable to get the correct title for this, please change the title
I'm able to get cells to format as Dates, but I've been unable to
I am unable to get this script to function correctly. When i try to
I'm trying get some licensing code from AndroidPit.com working, but I get Unable to
http://www.security.org.sg/code/loadexe.html http://pastebin.com/QFHASx75 I've compiled this but can't get it to work properly, It runs
I have posted this problem yesterday..but unfortunately, no one has given me the solution
I renamed the class classBattle to Game and not I get Unable to load
I am unable to get a highcharts plugin to render a chart in a
Why do I get the error: Unable to create a constant value of type

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.