Note that there are some explanatory texts on larger screens.

plurals
  1. POOpen a file upload menu in a web view not working
    primarykey
    data
    text
    <p>I need to be able to open a file upload menu from AndroidAddMember.aspx page in a web view. I found this fix but I dont think im implementing it correctly. <a href="http://m0s-programming.blogspot.com/2011/02/file-upload-in-through-webview-on.html" rel="nofollow">Fix</a></p> <p>The file upload button works fine in a browser on phone and pc but once in a web view the button does not work.</p> <p>I embed the page with the button in my first case statement below.</p> <p>Any help would be great. Thanks</p> <pre><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: 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&lt;Uri&gt; uploadMsg) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); Myactivity.this.startActivityForResult(Intent.createChooser(i,"File Chooser"), FILECHOOSER_RESULTCODE); } }); setContentView(wv); return true; default: return super.onOptionsItemSelected(item); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload