1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| package com.example.testeur;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.HttpAuthHandler;
public class MainActivity extends Activity {
private WebView MaVue = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MaVue = (WebView) findViewById(R.id.webView1);
MaVue.loadUrl("http://drive.intermarche.com/");
WebSettings settings = MaVue.getSettings();
settings.setJavaScriptEnabled(true);
MaVue.setWebViewClient(new WebViewClient () {
public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
handler.proceed("mon_identifiant", "mon_mot_de_passe");
}});
MaVue.loadUrl("http://drive.intermarche.com/Catalogue/NavigationProduits.aspx?c=2222&l=627");
}
} |
Partager