Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not open my file #39

Open
chenhua1008611 opened this issue Dec 2, 2019 · 0 comments
Open

Can not open my file #39

chenhua1008611 opened this issue Dec 2, 2019 · 0 comments

Comments

@chenhua1008611
Copy link

    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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant