젤리빈(Jelly Bean) 4.1 이상 WebView 사진선택 openFileChooser 방법

2012. 12. 28. 13:52Mobile/Android



반응형

 @SuppressWarnings("unused")
   public void openFileChooser(ValueCallback<Uri> uploadMsg) {
    openFileChooser(uploadMsg, "");
   }

   // For Android 3.0+
   public void openFileChooser(ValueCallback<Uri> uploadMsg,
     String acceptType) {
    mUploadMessage = uploadMsg;
    Intent i = new Intent(Intent.ACTION_GET_CONTENT);
    i.addCategory(Intent.CATEGORY_OPENABLE);
    i.setType("image/*");
    startActivityForResult(Intent.createChooser(i, "File Chooser"),
      Board.FILECHOOSER_RESULTCODE);
   }

   // For Android 4.1+
   @SuppressWarnings("unused")
   public void openFileChooser(ValueCallback<Uri> uploadMsg,
     String acceptType, String capture) {
    openFileChooser(uploadMsg, "");
   }
  });
       

반응형