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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:38:27+00:00 2026-06-13T03:38:27+00:00

I am adding the device list to the ArrayAdapter and show it in ListView,

  • 0

I am adding the device list to the ArrayAdapter and show it in ListView, where device list is getting from the Bluetooth scan, the scanned devices first add to the arrayadapter. Then later i am adding it to the listview to show the list of scanned bluetooth devices to user.

But when i am scanning for the devices, duplicate device is adding, suppose a device A is scanned means then again two or three times its showing device A. I want to show the list of scanned device only one time. How to achieve it. Sorry if question is vague.

Following code is for enquire new devices and adding it to arrayadapter:

if (BluetoothDevice.ACTION_FOUND.equals(action))
        {
            // Get the BluetoothDevice object from the Intent
            BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
            // If it's already paired, skip it, because it's been listed already
            if (device.getBondState() != BluetoothDevice.BOND_BONDED)
            {
                mNewDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress());
            }
        // When discovery is finished, change the Activity title
        } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
            setProgressBarIndeterminateVisibility(false);
            setTitle(R.string.select_device);
            if (mNewDevicesArrayAdapter.getCount() == 0) {
                String noDevices = getResources().getText(R.string.none_found).toString();
                mNewDevicesArrayAdapter.add(noDevices);
            }
        }

Its an program in Android example of version 4.1, example name is Bluetooth Chat. Where activity is DeviceListActivityScan.java.

  • 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-13T03:38:30+00:00Added an answer on June 13, 2026 at 3:38 am

    I run this demo in my two phones, only one will scan multiple times.
    so i guess it is relating to the devices.

    u can do that to avoid it:

                if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
                    String deviceInfo = device.getName() + "\n" + device.getAddress();
                    if(mNewDevicesArrayAdapter.getPosition(deviceInfo) < 0) {
                        mNewDevicesArrayAdapter.add(deviceInfo);
                    }
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

iam adding a contact to the device using this code long Contact_Id = 100;
I am adding some code to an existing FreeBSD device driver and I am
I'm adding iAd on my app.... I managed to have the banner sliding from
I'm developing a kernel driver for a USB device on OS X. After adding
I've made many mistakes in the process of adding a device to the organizer
My task is to track adding and deleting disk drives from windows service. I
I want to bind a combo box to a list of Device, List. I
public void GatherDataFromSwitches(Device[] switches) { List<Thread> workerThreads = new List<Thread>(); for(int i = 0;
I have an activity_A which contains listView, this listView dynamically increases in size adding
I'm adding HTTPS support to an embedded Linux device. I have tried to generate

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.