title: How can I manipulate the results from getScanResults()
body: <p>I'm learning how to build Android apps, and I have been searching how can I get all network spots arround my area, and I downloaded a code to understand how it works.</p>
  
  <p>But I would like to know how can I remove some SSIDs from the list that getScanResults() gives me.</p>
  
  <p>My target is to check if some SSID is not on my database, and remove it.</p>
  
  <p>I will post the full code, and I will say what I have done so far:</p>
  
  <p>My full code:</p>
  
  <pre><code>    @Override
      public void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          textStatus = (TextView) findViewById(R.id.textView1);
          buttonScan = (Button) findViewById(R.id.button1);
          buttonScan.setOnClickListener(this);
          lv = (ListView)findViewById(R.id.text);
  
          wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
          if (wifi.isWifiEnabled() == false)
          {
              Toast.makeText(getApplicationContext(), "wifi is disabled..making it enabled", Toast.LENGTH_LONG).show();
              wifi.setWifiEnabled(true);
          }   
          this.adapter = new SimpleAdapter(MainActivity.this, arraylist, android.R.layout.simple_list_item_1, new String[] { ITEM_KEY }, new int[] { android.R.id.text1 });
          lv.setAdapter(this.adapter);
  
  
          registerReceiver(new BroadcastReceiver()
          {
              @Override
              public void onReceive(Context c, Intent intent) 
              {
                 results = wifi.getScanResults();
                 size = results.size();
  
  
              }
          }, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));                    
      }
  
  
      public void onClick(View view) 
      {
          arraylist.clear();          
          wifi.startScan();
  
          Toast.makeText(this, "Scanning...." + size, Toast.LENGTH_SHORT).show();
          try 
          {
              size = size - 1; 
  
              String SSID = results.get(size).SSID;
  
              while (size &gt;= 0) 
              {  
                  HashMap&lt;String, String&gt; item = new HashMap&lt;String, String&gt;();  
  
                  String BSSID = results.get(size).BSSID;
  
                  int frequency = results.get(size).frequency;
  
                  item.put(ITEM_KEY, results.get(size).SSID.concat(" -"));
  
                  arraylist.add(item);
                  size--;
                  adapter.notifyDataSetChanged();    
  
              } 
          }
          catch (Exception e) 
          { }         
      }    
  }
  </code></pre>
  
  <p>What I have done so far:</p>
  
  <p>I tried to wrap the line that puts the items(SSIDs) on my hashmap. with an if statement to check if an specific name is equal to the current SSID. But it didn't worked because getScanResults sends me all the SSIDs together, and I'm trying to validate de SSIDs one by one.</p>
  
  <pre><code> while (size &gt;= 0) 
                  {  
                      HashMap&lt;String, String&gt; item = new HashMap&lt;String, String&gt;();  
  
                      String BSSID = results.get(size).BSSID;
  
                      int frequency = results.get(size).frequency;
  
                      if(results.get(size).SSID.equals("WIFI_NAME")){
                      item.put(ITEM_KEY, results.get(size).SSID.concat(" -"));
                      }
                      arraylist.add(item);
                      size--;
                      adapter.notifyDataSetChanged();    
  
                  } 
  </code></pre>
  
  <p>Can you guys help?</p>
  
  <p>Thanks.</p>