Fix sharing
This commit is contained in:
parent
24aadb5c66
commit
6d3ce28b48
2 changed files with 8 additions and 2 deletions
|
@ -41,9 +41,14 @@ class MainActivity : AppCompatActivity() {
|
|||
cowImage.outputStream().use { cowOut ->
|
||||
cowBitmap.compress(Bitmap.CompressFormat.JPEG, 100, cowOut)
|
||||
}
|
||||
val fileUri = FileProvider.getUriForFile(this@MainActivity, "com.wbrawner.cowsay.fileprovider", cowImage)
|
||||
val shareIntent = Intent(Intent.ACTION_SEND).apply {
|
||||
data = FileProvider.getUriForFile(this@MainActivity, "com.wbrawner.cowsay.fileprovider", cowImage)
|
||||
type = contentResolver.getType(data!!)
|
||||
setDataAndType(
|
||||
fileUri,
|
||||
contentResolver.getType(fileUri)
|
||||
)
|
||||
putExtra(Intent.EXTRA_STREAM, fileUri)
|
||||
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
}
|
||||
runOnUiThread {
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/preview_text"
|
||||
android:padding="8dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FF000000"
|
||||
|
|
Loading…
Reference in a new issue