Skip to content

Commit

Permalink
Read ME changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ParthLotia committed Mar 24, 2024
1 parent 61343d0 commit d7da248
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Here is the Demo for the PhotoPicker in All Android Versions

I have added other pickers as well(pdf,doc,video,pictures).

# There is no need to add any kind of permission and any library to select File from gallery .

I have tested with multiple scenarios , here is the scenario list

1. Android 8 to 13 versions
Expand All @@ -30,6 +32,45 @@ Here how to use library in your project follow below steps .
}
```

3. Add below code in your activity/fragment
```
In on create add below lines
btn_upload_pick.setOnClickListener {
val mimeType = "*/*"
/*Single Document Picker*/
// Image , Video , PDF , DOC , DOCX
pickMedia.launch(
arrayOf(mimeType)
)
}
Out side on create add below lines of code
private val pickMedia =
registerForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->
if (uri != null) {
val file = FileUriUtils.getRealPath(this, uri)?.let { File(it) }
if (FileUriUtils.checkExtensionFile(file)) {
img_pick.setImageURI(uri)
} else {
img_pick.setImageBitmap(
FileUtil.getThumbnail(
file,
uri,
context = applicationContext
)
)
}
} else {
Log.d("PhotoPicker", "No media selected")
}
}
Here img_pick is an Imageview to display the file you have selected .
```


<!--![LocationPermission](art/ss_location1.png)-->

Expand Down

0 comments on commit d7da248

Please sign in to comment.