Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get size of selected image in bytes
private void showFileChooser() {
Intent intent = new Intent();
startActivityForResult(Intent.createChooser(intent, "Select Picture"), 2);
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 2 && resultCode == RESULT_OK)
String path = data.getData().toString();
try {
f = new File(new URI(path));
} catch (URISyntaxException e) {
System.out.println("File size in bytes"+f.length());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.