Created
September 16, 2013 07:06
-
-
Save marwinxxii/6577472 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//imports | |
//webchromeclient for input type=file with file selector | |
public class CustomWebChromeClient extends WebChromeClient { | |
@SuppressWarnings("unused") | |
public void openFileChooser(ValueCallback<Uri> uploadMsg) { | |
mUploadMessage = uploadMsg; | |
Intent i = new Intent(Intent.ACTION_GET_CONTENT); | |
i.addCategory(Intent.CATEGORY_OPENABLE); | |
i.setType("image/*"); | |
startActivityForResult(Intent.createChooser(i, "Choose image"), 1); | |
} | |
@SuppressWarnings("unused") | |
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("*/*"); | |
startActivityForResult(Intent.createChooser(i, "File Browser"), 1); | |
} | |
// For Android 4.1 | |
@SuppressWarnings("unused") | |
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/*"); | |
startActivityForResult(Intent.createChooser(i, "File Chooser"), 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment