久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='HCWrk'></small><noframes id='HCWrk'>

    <legend id='HCWrk'><style id='HCWrk'><dir id='HCWrk'><q id='HCWrk'></q></dir></style></legend>

  • <i id='HCWrk'><tr id='HCWrk'><dt id='HCWrk'><q id='HCWrk'><span id='HCWrk'><b id='HCWrk'><form id='HCWrk'><ins id='HCWrk'></ins><ul id='HCWrk'></ul><sub id='HCWrk'></sub></form><legend id='HCWrk'></legend><bdo id='HCWrk'><pre id='HCWrk'><center id='HCWrk'></center></pre></bdo></b><th id='HCWrk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='HCWrk'><tfoot id='HCWrk'></tfoot><dl id='HCWrk'><fieldset id='HCWrk'></fieldset></dl></div>
  • <tfoot id='HCWrk'></tfoot>

      • <bdo id='HCWrk'></bdo><ul id='HCWrk'></ul>

        WebView 中的文件上傳

        File Upload in WebView(WebView 中的文件上傳)
        <i id='r4JHt'><tr id='r4JHt'><dt id='r4JHt'><q id='r4JHt'><span id='r4JHt'><b id='r4JHt'><form id='r4JHt'><ins id='r4JHt'></ins><ul id='r4JHt'></ul><sub id='r4JHt'></sub></form><legend id='r4JHt'></legend><bdo id='r4JHt'><pre id='r4JHt'><center id='r4JHt'></center></pre></bdo></b><th id='r4JHt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='r4JHt'><tfoot id='r4JHt'></tfoot><dl id='r4JHt'><fieldset id='r4JHt'></fieldset></dl></div>

        • <legend id='r4JHt'><style id='r4JHt'><dir id='r4JHt'><q id='r4JHt'></q></dir></style></legend>

          <small id='r4JHt'></small><noframes id='r4JHt'>

        • <tfoot id='r4JHt'></tfoot>

              <bdo id='r4JHt'></bdo><ul id='r4JHt'></ul>
                <tbody id='r4JHt'></tbody>
                • 本文介紹了WebView 中的文件上傳的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  自從最近幾次以來,我一直在努力從 WebView 上傳文件幾天了,一點進展都沒有.我用谷歌搜索并實施了所有建議解決方案,但沒有一個有效,例如:解決方案建議這里,等等.

                  I have been struggling to upload files from WebView since last few days and there is no progress. I googled and implemented all suggested solutions but none works, like: solutions suggested here, and so on.

                  問題:我有一個帶有以下代碼的 HTML 頁面來上傳文件.它在 Firefox 等桌面瀏覽器和內(nèi)置瀏覽器中運行良好模擬器/AVD,即當我點擊瀏覽..."按鈕呈現(xiàn)元素,瀏覽器打開一個對話框我可以在其中選擇要上傳的文件的框.

                  Problem: I have a HTML page with the following code to upload a file. It works fine in a desktop browser like Firefox and built-in browser of emulator / AVD i.e., when I click "Browse..." button rendered by element, browser opens a Dialog box where I can choose a file to upload.

                  但是,在 android 3.0 模擬器/AVD 中,當我點擊選擇文件",沒有任何反應,沒有打開文件對話框!!!

                  However, in the android 3.0 emulator / AVD, when I click on "Choose file", nothing happens, no file dialog is opened!!!

                  <form method="POST" enctype="multipart/form-data">
                  File to upload: <input type="file" name="uploadfile">&nbsp;&nbsp;
                  <input type="submit" value="Press to Upload..."> to upload the file!
                  </form>
                  

                  誰能盡早提出一個可能的解決方案.

                  推薦答案

                  這是一個適用于所有安卓版本的完整解決方案,我也遇到了困難.

                  This is a full solution for all android versions, I had a hard time with this too.

                  public class MyWb extends Activity {
                  /** Called when the activity is first created. */
                  
                  WebView web;
                  ProgressBar progressBar;
                  
                  private ValueCallback<Uri> mUploadMessage;  
                   private final static int FILECHOOSER_RESULTCODE=1;  
                  
                   @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 void onCreate(Bundle savedInstanceState) {
                      super.onCreate(savedInstanceState);
                      setContentView(R.layout.main);
                  
                      web = (WebView) findViewById(R.id.webview01);
                      progressBar = (ProgressBar) findViewById(R.id.progressBar1);
                  
                      web = new WebView(this);  
                      web.getSettings().setJavaScriptEnabled(true);
                      web.loadUrl("http://www.script-tutorials.com/demos/199/index.html");
                      web.setWebViewClient(new myWebClient());
                      web.setWebChromeClient(new WebChromeClient()  
                      {  
                             //The undocumented magic method override  
                             //Eclipse will swear at you if you try to put @Override here  
                          // For Android 3.0+
                          public void openFileChooser(ValueCallback<Uri> uploadMsg) {  
                  
                              mUploadMessage = uploadMsg;  
                              Intent i = new Intent(Intent.ACTION_GET_CONTENT);  
                              i.addCategory(Intent.CATEGORY_OPENABLE);  
                              i.setType("image/*");  
                              MyWb.this.startActivityForResult(Intent.createChooser(i,"File Chooser"), FILECHOOSER_RESULTCODE);  
                  
                             }
                  
                          // For Android 3.0+
                             public void openFileChooser( ValueCallback uploadMsg, String acceptType ) {
                             mUploadMessage = uploadMsg;
                             Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                             i.addCategory(Intent.CATEGORY_OPENABLE);
                             i.setType("*/*");
                             MyWb.this.startActivityForResult(
                             Intent.createChooser(i, "File Browser"),
                             FILECHOOSER_RESULTCODE);
                             }
                  
                          //For Android 4.1
                             public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture){
                                 mUploadMessage = uploadMsg;  
                                 Intent i = new Intent(Intent.ACTION_GET_CONTENT);  
                                 i.addCategory(Intent.CATEGORY_OPENABLE);  
                                 i.setType("image/*");  
                                 MyWb.this.startActivityForResult( Intent.createChooser( i, "File Chooser" ), MyWb.FILECHOOSER_RESULTCODE );
                  
                             }
                  
                      });  
                  
                  
                      setContentView(web);  
                  
                  
                  }
                  
                  public class myWebClient extends WebViewClient
                  {
                      @Override
                      public void onPageStarted(WebView view, String url, Bitmap favicon) {
                          // TODO Auto-generated method stub
                          super.onPageStarted(view, url, favicon);
                      }
                  
                      @Override
                      public boolean shouldOverrideUrlLoading(WebView view, String url) {
                          // TODO Auto-generated method stub
                  
                          view.loadUrl(url);
                          return true;
                  
                      }
                  
                      @Override
                      public void onPageFinished(WebView view, String url) {
                          // TODO Auto-generated method stub
                          super.onPageFinished(view, url);
                  
                          progressBar.setVisibility(View.GONE);
                      }
                  }
                  
                  //flipscreen not loading again
                  @Override
                  public void onConfigurationChanged(Configuration newConfig){        
                      super.onConfigurationChanged(newConfig);
                  }
                  
                  // To handle "Back" key press event for WebView to go back to previous screen.
                  /*@Override
                  public boolean onKeyDown(int keyCode, KeyEvent event) 
                  {
                      if ((keyCode == KeyEvent.KEYCODE_BACK) && web.canGoBack()) {
                          web.goBack();
                          return true;
                      }
                      return super.onKeyDown(keyCode, event);
                  }*/
                  }
                  

                  我還想補充一點,像本例中的上傳頁面"在 < 上不起作用.4個版本,因為它有圖片預覽功能,如果你想讓它工作,使用一個簡單的php上傳,不帶預覽.

                  Also I want to add that the "upload page" like the one in this example, wont work on < 4 versions, since it has an image preview feature, if you want to make it work use a simple php upload without preview.

                  更新:

                  請在這里找到棒棒糖設備的解決方案 并感謝 鬼臉

                  更新 2:

                  在 oreo here 和 這是更高級的版本,你應該看看它,也許它可以幫助.

                  Complete solution for all android devices till oreo here and this is more advanced version, you should look into it, maybe it can help.

                  這篇關于WebView 中的文件上傳的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網(wǎng)絡提供商)
                  Get current location during app launch(在應用啟動期間獲取當前位置)
                  locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)
                      <tbody id='0qGO8'></tbody>
                    <tfoot id='0qGO8'></tfoot>

                      <legend id='0qGO8'><style id='0qGO8'><dir id='0qGO8'><q id='0qGO8'></q></dir></style></legend>
                        <bdo id='0qGO8'></bdo><ul id='0qGO8'></ul>

                          <small id='0qGO8'></small><noframes id='0qGO8'>

                            <i id='0qGO8'><tr id='0qGO8'><dt id='0qGO8'><q id='0qGO8'><span id='0qGO8'><b id='0qGO8'><form id='0qGO8'><ins id='0qGO8'></ins><ul id='0qGO8'></ul><sub id='0qGO8'></sub></form><legend id='0qGO8'></legend><bdo id='0qGO8'><pre id='0qGO8'><center id='0qGO8'></center></pre></bdo></b><th id='0qGO8'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0qGO8'><tfoot id='0qGO8'></tfoot><dl id='0qGO8'><fieldset id='0qGO8'></fieldset></dl></div>
                            主站蜘蛛池模板: 在线观看国产h | a黄毛片| 午夜在线电影网 | 国产精品一区二区精品 | 欧美在线观看一区 | 成人在线视频一区 | 久久久久久国产精品久久 | 99国产视频 | 中文字幕 在线观看 | 九色 在线 | 伦理片97 | 区一区二在线观看 | 国产视频一区二区 | 欧美偷偷 | 欧美精品久久久久 | 91精品国产色综合久久不卡98口 | av在线天堂 | 99久热在线精品视频观看 | 久久久久中文字幕 | 亚洲欧美一区二区三区在线 | 97超级碰碰| 亚洲精品视频一区 | 国产免费播放视频 | 国产亚洲精品美女久久久久久久久久 | 欧美日本在线 | 国产91av视频在线观看 | av一级久久| 国产亚洲成av人片在线观看桃 | 国产精品视频一区二区三区四区国 | 国产日产精品一区二区三区四区 | 久久久免费观看视频 | 亚洲最大的黄色网址 | 久久一级| 欧美日本一区二区 | 亚洲综合色 | 国产免费一区二区三区 | 久久久久久成人 | 欧美日韩中文字幕在线播放 | 精产国产伦理一二三区 | 在线成人av | 亚洲成人久久久 |