https://kotlinlang.org logo
#getting-started
Title
# getting-started
n

Nahuel Canavy

02/14/2022, 8:51 AM
Hello, I'm new to Kotlin and I'm trying to code an application with the IDE AndroidStudio. I would like to recover a csv file send by an other application thus I would like that my application shows in the selection area of the other application ( like Gmail in the ScreenShot). Do you you know how I can do this ? Or do you have any link that explain how to do it ?
n

Nicolas B

02/14/2022, 8:52 AM
Hi, you can watch share data with Intent
n

Nahuel Canavy

02/14/2022, 8:54 AM
I wrote this in my AndroidManist but my app still won't show in the selection area of the other app :
Copy code
<intent-filter>
                <action android:name="android.intent.action.SEND"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:name="text/csv"/>
            </intent-filter>
n

Nicolas B

02/14/2022, 8:56 AM
??
Copy code
val sendIntent: Intent = Intent().apply {
    action = Intent.ACTION_SEND
    putExtra(Intent.EXTRA_TEXT, "This is my text to send.")
    type = "text/plain"
}

val shareIntent = Intent.createChooser(sendIntent, null)
startActivity(shareIntent)
adapt your code and it’s finish
n

Nahuel Canavy

02/14/2022, 9:40 AM
thank you 🙂
4 Views