Issue
I cant see me get this web view to open up with the new code below. I had it working with the commented out code. I need to get the new code to load the web view. Im using this sample code. How can i fix the issues of it not opening up the page? The Sample code
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
if(requestCode==FILECHOOSER_RESULTCODE)
{
if (null == mUploadMessage) return;
Uri result = intent == null || resultCode != RESULT_OK ? null
: intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.register:
//mWebView2 = (WebView) findViewById(R.id.webview);
// mWebView2.getSettings().setJavaScriptEnabled(true);
// mWebView2.loadUrl("http://www.Mysite.com/AndroidAddMember.aspx");
//mWebView2.setWebViewClient(new HelloWebViewClient());
wv = new WebView(this);
wv.setWebViewClient(new WebViewClient());
wv.getSettings().setJavaScriptEnabled(true);
wv.loadUrl("http://www.Mysite.com/AndroidAddMember.aspx");
wv.setWebViewClient(new WebViewClient());
wv.setWebChromeClient(new WebChromeClient()
{
//The undocumented magic method override
//Eclipse will swear at you if you try to put @Override here
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
BangMeorNot.this.startActivityForResult(Intent.createChooser(i,"File Chooser"), FILECHOOSER_RESULTCODE);
}
});
setContentView(wv);
return true;
Solution
Maybe because you are initializing the same webview twice and during the second time, you are not calling loadUrl() method on it.
Try setting the url after the second initialization also. The problem is that you are setting the content view to the webview, but the webview has no url to load.
Answered By - Anup Cowkur
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.