Code example for PasswordAuthentication

0
		try{ 
			Log.w(MSPClientActivity.class.getName(), "trying get image ...");
			Authenticator ath = new Authenticator() {
				@Override 
				protected PasswordAuthentication getPasswordAuthentication() {
					PasswordAuthentication pw = new PasswordAuthentication("mspwebhome", "1u1ifalsch".toCharArray());
					return pw;
				} 
			}; 
			 
			Authenticator.setDefault(ath);
			HttpURLConnection conTh = (HttpURLConnection) f.getImage().openConnection();
			bm = BitmapFactory.decodeStream(conTh.getInputStream());
			Log.w(MSPClientActivity.class.getName(), "displaying image in screen ...");
			fotoView.setImageBitmap(bm);
			fotoView.invalidate();
		}catch(Exception e){
			e.printStackTrace();
		} 
	} 
}