I've included a a WebView
in my Android app that connects to a credit card verification service.
The form loads correctly and I get errors as expected if I put in the wrong values. However, for the correct values the service redirects to another page that should show the successful verification message. Instead, I only get an "Object moved to here" message. When I click the 'here' it just goes blank.
I tried overloading the WebViewClient
as below thinking that the redirect may not be handling correctly but that doesn't seem to help.
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("http://username:password@address...");
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.e("WebViewLog",url);
view.loadUrl(url);
return true;
}
});
What can I do to fix this ?
I should add that the URL's have basic authentication. I pass this information in the URL is mWebView.loadUrl("http://username:password@address...")
.
LogCat is as below:
01-21 23:02:12.167: D/dalvikvm(3974): GC_CONCURRENT freed 1240K, 58% free 3061K/7175K, external 3160K/3465K, paused 1ms+2ms
01-21 23:02:17.867: D/navcache(3974): cursorInputFieldAction : No node under current cursor
01-21 23:02:17.867: D/navcache(3974): cursorInputFieldAction cursor=50e014, cursorFrame=50d828
01-21 23:02:17.867: D/navcache(3974): CachedFrame::previousInputField this=50d828, start=50e014, begin=50dfb0 end=50e208
01-21 23:02:17.867: D/navcache(3974): CachedFrame::nextInputField this=50d828, start=50e014, begin=50dfb0 end=50e208
01-21 23:02:17.867: D/navcache(3974): cursorInputFieldAction next=50e140, prev=0, action=8
01-21 23:02:17.999: V/webview(3974): OnSizeChanged: Enter
01-21 23:02:17.999: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:20.335: W/KeyCharacterMap(3974): No keyboard for id 0
01-21 23:02:20.335: W/KeyCharacterMap(3974): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-21 23:02:20.363: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:20.878: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:21.320: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:22.164: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:22.855: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:23.183: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:23.492: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:23.769: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:24.531: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:24.874: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:25.187: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:25.507: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:27.210: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:27.546: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:27.812: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:28.117: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:37.542: D/navcache(3974): cursorInputFieldAction cursor=4bd634, cursorFrame=4f3160
01-21 23:02:37.542: D/navcache(3974): CachedFrame::previousInputField this=4f3160, start=4bd634, begin=4bd5d0 end=4bd828
01-21 23:02:37.542: D/navcache(3974): CachedFrame::nextInputField this=4f3160, start=4bd634, begin=4bd5d0 end=4bd828
01-21 23:02:37.542: D/navcache(3974): cursorInputFieldAction next=4bd760, prev=0, action=8
01-21 23:02:37.632: E/webtextview(3974): ....Doing a super.requestRectangleOnScreen....
01-21 23:02:37.648: V/webview(3974): OnSizeChanged: Enter
01-21 23:02:38.847: D/navcache(3974): cursorInputFieldAction cursor=507fd0, cursorFrame=4f3160
01-21 23:02:38.847: D/navcache(3974): CachedFrame::previousInputField this=4f3160, start=507fd0, begin=507e40 end=508098
01-21 23:02:38.847: D/navcache(3974): CachedFrame::nextInputField this=4f3160, start=507fd0, begin=507e40 end=508098
01-21 23:02:38.847: D/navcache(3974): cursorInputFieldAction next=508034, prev=507ea4, action=9
01-21 23:02:39.070: D/dalvikvm(3974): GC_CONCURRENT freed 1098K, 57% free 3087K/7175K, external 3171K/3465K, paused 2ms+2ms
01-21 23:02:39.109: V/webview(3974): OnSizeChanged: Enter
01-21 23:02:39.164: V/webview(3974): Select Control Rect(101, 210 - 161, 241)
01-21 23:02:41.261: V/webview(3974): OnSizeChanged: Enter
01-21 23:02:42.656: D/navcache(3974): cursorInputFieldAction cursor=507ff4, cursorFrame=4cb1d0
01-21 23:02:42.656: D/navcache(3974): CachedFrame::previousInputField this=4cb1d0, start=507ff4, begin=507e00 end=508058
01-21 23:02:42.656: D/navcache(3974): CachedFrame::nextInputField this=4cb1d0, start=507ff4, begin=507e00 end=508058
01-21 23:02:42.656: D/navcache(3974): cursorInputFieldAction next=0, prev=507f90, action=18
01-21 23:02:42.847: V/webview(3974): OnSizeChanged: Enter
01-21 23:02:42.902: V/webview(3974): Select Control Rect(165, 210 - 242, 241)
01-21 23:02:45.308: V/webview(3974): OnSizeChanged: Enter
01-21 23:03:12.296: D/dalvikvm(3974): GC_CONCURRENT freed 1166K, 57% free 3129K/7175K, external 3171K/3465K, paused 9ms+3ms
01-21 23:03:12.304: D/webviewglue(3974): nativeDestroy view: 0x449480
I get the Doing a super.requestRectangleOnScreen
error every time I click something. Otherwise, the Log.e
that I put in the WebViewClient code doesn't even show.
Update: I did the same activity on the Android browser (on a Galaxy Tab). No problems at all but I'm noting the differences here for reference. I get a username and password prompt cause I use the direct link but I also get a certificate exception which I accept because this is a BETA for testing. Also, the Android browser works using both http://
and https://
but the WebView
doesn't even show the first page is I use https://
with the URL.