Well, I now have the solution and it had nothing to do with
requestFocusNodeHref() and a lot to do with using javascript. But I
believe I was right about my code being in the call tree of
loadDataWithBaseUrl().
What I had to do was turn on Javascript by using this code:
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
And then in the definition of the WebViewClient I had to implement the
onPageFinished(WebView, String) method. I used the following code:
public void onPageFinished(final WebView view, final String url) {
// make it jump to the internal link
if (mFragment != null) {
view.loadUrl("javascript:location.href=\"#" + mFragment + "\"");
mFragment = null;
}
}
The loadUrl() method causes the javascript to run.
VERY IMPORTANT: I had to make sure to set the mFragment to null
because the loadUrl() method caused the onPageFinished() method to get
called again. If mFragment was not set to null onPageFinished() would
get called again while mFragment was still non-null and an endless
loop would have been the result.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---