title: ACTION_PICK_WIFI_NETWORK on a dialog with avaliable networks
body: <p>I'm trying to create a <code>Dialog</code> which shows something like <code>ACTION_PICK_WIFI_NETWORK</code> but instead of open <code>Android Settings / WiFi</code> open it on a <code>Dialog</code> and if it's possible user could connect to any network avaliable from that <code>Dialog</code>. What I've at the moment is open a <code>Dialog</code> with a <code>List</code> of available Wi-Fi networks in Android, but this <code>List</code> isn't the same as <code>Android Settings / WiFi</code> thats why I'm asking if it's possible to open this <code>ACTION_PICK_WIFI_NETWORK</code> on a dialog and work with it. If it's not possible how could I connect to network clicking on a <code>Item</code> from my <code>Dialog</code> with WiFi avaliable?</p>
  
  <h2>What I've tried so far is</h2>
  
  <p>I've got a <code>BroadcastReceiver()</code></p>
  
  <pre><code>wifiReceiver = new BroadcastReceiver(){
  @Override
    public void onReceive(Context c, Intent intent){  
         if(mWifiManager != null) {
            List&lt;ScanResult&gt; results = mWifiManager.getScanResults();
            showWifiListDialog(results);
         }
    }
  };
  </code></pre>
  
  <p>A <code>RegisterReceiver()</code></p>
  
  <pre><code>registerReceiver(wifiReceiver,new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
  </code></pre>
  
  <p>This is the method that does the <code>WifiScan</code></p>
  
  <pre><code>private void startWifiScans() {
   mWifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
   mWifiManager.startScan();
  }
  </code></pre>
  
  <p>And this is the simple <code>Dialog</code> which shows the <code>SCAN_RESULTS_AVAILABLE_ACTION</code> </p>
  
  <pre><code>private void showWifiListDialog(List&lt;ScanResult&gt; results) {
      AlertDialog.Builder builderSingle = new AlertDialog.Builder(
              this);
      final ArrayAdapter&lt;String&gt; arrayAdapter = new ArrayAdapter&lt;String&gt;(
              this,
              android.R.layout.select_dialog_item);
  
      for (ScanResult r: results) {
          if(r == null || r.SSID == null) continue;
          if("".equalsIgnoreCase(r.SSID.trim())) continue;
          String name = r.SSID.replace("\"", "");
          arrayAdapter.add(name);
      }
      builderSingle.setNegativeButton(getString(R.string.cancel),
              new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                      dialog.dismiss();
                  }
              });
      builderSingle.setAdapter(arrayAdapter,
              new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                      String strName = arrayAdapter.getItem(which);
                      Toast.makeText(getApplicationContext(),"Selected "+strName, Toast.LENGTH_SHORT).show();
                  }
              });
      AlertDialog dialog = builderSingle.create();
      dialog.show();
  }
  </code></pre>
  
  <h2>Example with images</h2>
  
  <p><a href="https://i.stack.imgur.com/4Augn.jpg" rel="nofollow noreferrer">This</a> and <a href="http://forums.androidcentral.com/attachments/motorola-droid-maxx/165590d1425418311t-can-t-get-rid-annoying-wifi-dialog-screenshot_2015-02-19-13-10-31.png" rel="nofollow noreferrer">this</a> are examples or what I'm looking for.</p>
  
  <h2>EDIT (This is how I see my <code>Dialog</code> at the moment but I don't like it yet....)</h2>
  
  <p><img src="https://i.stack.imgur.com/g5h1y.jpg" alt="enter image description here"></p>
  
  <p>I'd like to show the networks with the <code>icon</code> with signal strength like android does <a href="https://i.imgur.com/0s5hzLO.jpg" rel="nofollow noreferrer">example</a>. I think I'll need a ListAdapter or so? And then add the Network name, Strength connection, icon, etc... Am I wrong? </p>
  
  <p>Almost the same question right <a href="https://stackoverflow.com/q/28828179/4385913">there</a>..</p>
  
  <p>I want to open it throught a <code>Notification</code> and obviously it doesn't matter if I'm on that APP or other APP... I just want to open it as a dialog and let to the user see what the user was watching.</p>
  
  <p>Now what I get is this : </p>
  
  <p><img src="https://i.stack.imgur.com/e2Z1S.png" alt="enter image description here"></p>
  
  <p>I'm using a <code>Theme</code> but it doesn't do what I want.</p>
  
  <pre><code>&lt;style name="dialogtest" parent="AppTheme"&gt;
      &lt;item name="android:windowFrame"&gt;@android:color/transparent&lt;/item&gt;
      &lt;item name="android:windowIsFloating"&gt;true&lt;/item&gt;
      &lt;item name="android:windowIsTranslucent"&gt;true&lt;/item&gt;
      &lt;item name="android:windowNoTitle"&gt;true&lt;/item&gt;
      &lt;item name="android:background"&gt;@android:color/transparent&lt;/item&gt;
      &lt;item name="android:windowBackground"&gt;@android:color/transparent&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>This is the style and I call it doing this : </p>
  
  <pre><code> protected void onCreate(Bundle savedInstanceState) {
      setTheme(R.style.dialogtest);
      super.onCreate(savedInstanceState);
  </code></pre>