일반적인 file chooser는 [[android:안드로이드에서_file_chooser_만들기|안드로이드에서 파일 열기 대화상자 만들기]]를 참고할 것 ===== 1. Intent에 Mime을 구성해 주는 함수 만들기 ===== // Custom Mime Type을 Intent에 세팅해 주기 class GetContentWithMultiFilter:ActivityResultContracts.GetContent() { override fun createIntent(context: Context, input:String): Intent { val inputArray = input.split(";").toTypedArray() val myIntent = super.createIntent(context, "*/*") myIntent.putExtra(Intent.EXTRA_MIME_TYPES, inputArray) return myIntent } } ===== 2. 파일 열기 대화상자 함수 만들기 ===== // File Chooser 함수 val pickPictureLauncher = rememberLauncherForActivityResult( GetContentWithMultiFilter()) { hwpUri -> if (hwpUri != null) { // Update the state with the Uri name = hwpUri.path.toString() val file: File = File(hwpUri.getPath()) //create path from uri val split = file.path.split(":".toRegex()).dropLastWhile { it.isEmpty() } .toTypedArray() //split the path. fname = split[1] //assign it to a string(your choice). } } ===== 3. 불러오기 ===== val inputString= "application/vnd.hancom.hwp;application/haansofthwp;application/x-hwp" // 한글 mime Button(onClick = { pickPictureLauncher.launch(inputString) } ) { Text(text = stringResource(R.string.fileopen)) }