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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:41:58+00:00 2026-06-06T14:41:58+00:00

I have the next code : public class AddPrinter extends ListActivity { @Override public

  • 0

I have the next code :

public class AddPrinter extends ListActivity {

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

    bluetoothAdapter.startDiscovery();
    filter = new IntentFilter();
    filter.addAction(BluetoothDevice.ACTION_FOUND);
    filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
    filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    registerReceiver(receiver, filter);
}

BroadcastReceiver receiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        System.out.println(action);
        if (BluetoothDevice.ACTION_FOUND.equals(action)) {
            BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
            adapter.add(device);
        }
        else if (BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(intent.getAction())) {
            System.out.println("STARTED");
        }
        else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(intent.getAction())) {
            Utils.dialog.dismiss();
        }
    }
};

The problem i have is so weird, for some reason the ACTION_DISCOVERY_STARTED is never called, but all the other actions are fine, what am i missing? thank you for your time.

  • 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-06T14:41:59+00:00Added an answer on June 6, 2026 at 2:41 pm

    try this

    public class AddPrinter extends ListActivity {
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
                filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);  
                registerReceiver(receiver, filter);  
                filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_STARTED);  
                registerReceiver(receiver, filter);  
                filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);  
                registerReceiver(receiver, filter); 
    
                 //
                 bluetoothAdapter.startDiscovery();
    
    }
    

    put bluetoothAdapter.startDiscovery(); after registering recevier

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

Sidebar

Related Questions

I have the next code: class Printer{ Activity activity; public Printer (Activity activity) {
i have written the next code: public void delete(MyType instance) { List<MyType> myList =
I have the next code: class Foo { public Foo (String param) { ...
I have the following code public class A extends Iterable<Integer> { ... public Iterator<Integer>
I currently have the following code: public class Count { public static void countChar()
I have a servlet program. This is my code: public class CompanionProxy extends HttpServlet
i have next php code <?php class A { public function foo() { }
I have next code require 'rack/rpc' class Server < Rack::RPC::Server def hello_world Hello, world!
I have the next code: public static T GetSerializedCopy<T> (T src) { //some code
Can someone explain me the difference between Class.forName() and Thread.currentThread().getContextClassLoader().loadClass(). I have next code

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.