title: Android ICS WebViewClient onReceivedHttpAuthRequest No Longer Returns UserId and Password
body: <p>I have a WebView that works fine with previous releases of the Android OS, but has issues loading for Ice Cream Sandwich devices. The page I'm attempting to load require BASIC AUTH and is passing in a query string parameter for non security purposes. </p>
  
  <p><strong>The issue is with the WebViewClient.onReceivedHttpAuthRequest method:</strong></p>
  
  <pre><code> String[] up = view.getHttpAuthUsernamePassword(host, realm);
  </code></pre>
  
  <p>Its returning a null array instead of the user's id and password.  Anyone know why this acts differently in Android ICS?  I get the user id and password for other versions of the OS.</p>
  
  <p><strong>Full Code:</strong></p>
  
  <pre><code>public class DestinationWebViewScreen extends Activity{
  
      WebView mWebView;
  
      @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
  
              setContentView(R.layout.destination_webview);
  
              mWebView = (WebView) findViewById(R.id.social_destination_webview);
              mWebView.getSettings().setJavaScriptEnabled(true);
              mWebView.getSettings().setLoadsImagesAutomatically(true);
              mWebView.clearCache(true);
              mWebView.clearFormData();
              mWebView.clearHistory();   
              mWebView.getSettings().setBuiltInZoomControls(true); 
  
              mWebView.setHttpAuthUsernamePassword("HOST_OF_WEBAPP","Spring Security Application", "USERID", "PASSWORD");
  
              mWebView.setWebViewClient( new WebViewClient() { 
                  @Override 
                  public void onReceivedHttpAuthRequest  (WebView view, 
                          HttpAuthHandler handler, String host,String realm){ 
  
                      String[] up = view.getHttpAuthUsernamePassword(host, realm); 
                      if( up != null &amp;&amp; up.length == 2 ) { 
                          handler.proceed(up[0], up[1]); 
                      } 
                  }
  
  
                  @Override
                  public void onPageStarted(WebView view, String url, Bitmap favicon) {
                      super.onPageStarted(view, url, favicon);
  
                      if(progressDialog != null){
                          progressDialog.dismiss();
                      }
  
                      showProgressbar();
                  }
  
  
                  @Override
                  public void onPageFinished(WebView view, String url) {              
                      super.onPageFinished(view, url);
  
                      dismissProgressDialog();
                  }
  
                  @Override
                  public void onReceivedError(WebView view, int errorCode,
                          String description, String failingUrl) {                
                      super.onReceivedError(view, errorCode, description, failingUrl);
  
                      dismissProgressDialog();
  
  
                  }
  
  
  
              });
  
      mWebView.loadUrl("https://webapphost/webapp?customerId=0-222293");
  
      IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);        
              registerReceiver(networkStateReceiver, filter);
      }
  
      public void showProgressbar() {
          progressDialog = new CustomProgressDialog(SocialDestinationWebViewScreen.this); 
          progressDialog.getWindow().setBackgroundDrawable(getResources().getDrawable(android.R.color.transparent));
          progressDialog.setMessage(SocialDestinationWebViewScreen.this.getResources().getString(R.string.loading));
          progressDialog.show();
      }
  
  
      void dismissProgressDialog(){
  
          if(progressDialog != null){
              progressDialog.dismiss();
          }
  
          progressDialog = null;
      }
  
  }
  </code></pre>