Skip to content

Commit 26e6103

Browse files
committed
Share files as stream
1 parent 00b9e3e commit 26e6103

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

app/src/main/kotlin/com/njlabs/showjava/activities/explorer/navigator/NavigatorActivity.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package com.njlabs.showjava.activities.explorer.navigator
2121
import android.app.ProgressDialog
2222
import android.content.ActivityNotFoundException
2323
import android.content.Intent
24+
import android.net.Uri
2425
import android.os.Bundle
2526
import android.os.Environment
2627
import android.view.Menu
@@ -239,14 +240,11 @@ class NavigatorActivity : BaseActivity() {
239240
dismissProgressDialog()
240241
val shareIntent = Intent()
241242
shareIntent.action = Intent.ACTION_SEND
242-
shareIntent.setDataAndType(
243-
FileProvider.getUriForFile(
244-
context,
245-
context.applicationContext.packageName + ".provider",
246-
file
247-
),
248-
MimeTypeMap.getSingleton().getMimeTypeFromExtension(file.extension)
243+
shareIntent.putExtra(
244+
Intent.EXTRA_STREAM,
245+
FileProvider.getUriForFile(context, context.applicationContext.packageName + ".provider", file)
249246
)
247+
shareIntent.type = "application/zip"
250248
startActivity(
251249
Intent.createChooser(
252250
shareIntent,

app/src/main/res/xml/file_provider_paths.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
<!--suppress AndroidElementNotAllowed -->
2121
<paths>
22+
<external-path name="external_files" path="."/>
2223
<root-path
2324
name="root"
2425
path="." />

0 commit comments

Comments
 (0)