Deepak Gahlot
02/25/2021, 12:01 PMpawegio
02/25/2021, 12:17 PMDeepak Gahlot
02/25/2021, 12:18 PMDeepak Gahlot
02/25/2021, 12:28 PM@Composable
fun AttachmentComponent() {
val context = LocalContext.current
val file = File(Environment.getExternalStorageDirectory().absolutePath + "/" + "deepak")
fun openFileExplorer() {
val target = Intent(Intent.ACTION_GET_CONTENT)
target.setDataAndType(Uri.fromFile(file),"application/pdf");
target.flags = Intent.FLAG_ACTIVITY_NO_HISTORY;
val intent = Intent.createChooser(target, "Open File")
context.startActivity(intent)
}
Column {
Text(text = "Attachment")
OutlinedButton(
onClick = { openFileExplorer() }
) {
Icon(painterResource(id = R.drawable.ico_attach), contentDescription = "attach")
Text(text = "Add Files")
}
}
}
Deepak Gahlot
02/25/2021, 12:29 PMSaurabhS
02/25/2021, 12:30 PMregisterForActivityResult
function available for that purpose.Ian Lake
02/25/2021, 1:53 PMDeepak Gahlot
02/25/2021, 2:20 PM