Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to synchronize WifiManager.startscan() and WifiManager.getScanResults?
    primarykey
    data
    text
    <p>I am trying to scan for access points every second. Here's what I am doing. </p> <pre><code> if (isScanning()) { new Timer().schedule(new TimerTask() { @Override public void run() { results = manager.getScanResults(); manager.startScan(); } }, 0,1000); adapter.notifyDataSetChanged(); </code></pre> <p>I am displaying the results using a BaseAdapter.</p> <pre><code>public View getView(int position, View convertView, ViewGroup parent) { ScanResult result = results.get(position); if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.network_list_row, null); } // Get textview fields TextView txtSSID = (TextView) convertView.findViewById(R.id.txtSSID); TextView txtBSSID = (TextView) convertView.findViewById(R.id.txtBSSID); TextView txtCapabilities = (TextView) convertView .findViewById(R.id.txtCapabilities); TextView txtFrecuency = (TextView) convertView .findViewById(R.id.txtFrecuency); TextView txtLevel = (TextView) convertView.findViewById(R.id.txtLevel); if (result.SSID.equalsIgnoreCase(ScanNetworks.manager .getConnectionInfo().getSSID())) { txtSSID.setText(convertView.getContext().getString( R.string.ssid_msg, result.SSID)); txtBSSID.setText(convertView.getContext().getString( R.string.bssid_msg, result.BSSID)); txtCapabilities.setText(convertView.getContext().getString( R.string.capabilities_msg, result.capabilities)); txtFrecuency.setText(convertView.getContext().getString( R.string.frecuency_msg, Integer.toString(result.frequency))); txtLevel.setText(convertView.getContext().getString( R.string.signal_level_msg, Integer.toString(result.level))); ; </code></pre> <p>I see a lot of duplicates when I display the results of the scan. I know there is an overlap between every second the startScan() is called. Is there a way I can eliminate the duplicates in the display? Also, how do I synchronize the startScan() and getScanresults() call? Please advice. Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload