From e3f0b507ea4766c8611374ea8399307402dd8ae6 Mon Sep 17 00:00:00 2001 From: "M. Fadli Zein" <45892408+gzeinnumer@users.noreply.github.com> Date: Sun, 7 Mar 2021 18:03:02 +0700 Subject: [PATCH] Update README.md --- README.md | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c466b6c..78318e5 100644 --- a/README.md +++ b/README.md @@ -203,14 +203,25 @@ Log.d(TAG, "onCreate_7: "+ result_7); // 663219154.png //Remove Extension String result_8 = MBUtilsString.removeExtension(result_7); Log.d(TAG, "onCreate_8: "+ result_8); // 663219154 - -//Remove Extension -Uri fileUri = data.getData(); -String filePath = null; -try { - filePath = MBUtilsString.getPath(getApplicationContext(), fileUri); -} catch (Exception e) { - Toast.makeText(getApplicationContext(), "Error: " + e, Toast.LENGTH_SHORT).show(); +``` +Get File Path +```java +//get File Path +@Override +public void onActivityResult(int requestCode, int resultCode, Intent data) { + + ... + + Uri fileUri = data.getData(); + String filePath = null; + try { + filePath = MBUtilsString.getPath(getApplicationContext(), fileUri); + } catch (Exception e) { + Toast.makeText(getApplicationContext(), "Error: " + e, Toast.LENGTH_SHORT).show(); + } + + ... + } ```