Skip to content

Can not open my file #39

@chenhua1008611

Description

@chenhua1008611
    Just open recently file ,It's my code :

val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.addCategory(Intent.CATEGORY_DEFAULT)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {

        val contentUri = FileProvider.getUriForFile(this@TalentReportActivity, "com.gkzy.im.fileprovider", file)
        intent.setData(contentUri)
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
        intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
        intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri)
        startActivity(intent)
		}else{
		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        intent.setDataAndType(Uri.fromFile(file),"*/*")
        startActivity(intent)
		}

How can I resove this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions