We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm creating a new csv document in device's Downloads folder with below usage:
class ExportRecipientsContract(private val context: Context, private val recipients: List<RecipientItemModel>) : ActivityResultContract<Unit, Unit>() { override fun createIntent(context: Context, input: Unit) = Intent(Intent.ACTION_CREATE_DOCUMENT).apply { addCategory(Intent.CATEGORY_OPENABLE) type = "text/csv" putExtra(Intent.EXTRA_TITLE, "Sample.csv") } override fun parseResult(resultCode: Int, intent: Intent?) { if (resultCode == Activity.RESULT_OK) { try { intent?.data?.let { uri -> val csvProcessor: CsvProcessor<RecipientItemModel> = CsvProcessor(RecipientItemModel::class.java) csvProcessor.writeAll(File(uri.toString()), recipients, true) } } catch (e: Exception) { Timber.e(e) } } } }
Most probably I'm doing something wrong because the data does not get written into the file.
But when I write with OutputStream instead of csvProcessor then it works fine
val data = "\"amount\",\"currency\",\"id\",\"name\",\"phoneNumber\",\"reference\"\n" + "\"15000\",\"AED\",\"1\",\"Aydin Mehmet Ozkan\",\"+254504631682\",\"Salary\"\n" + "\"20000\",\"AED\",\"2\",\"Michail Kulaga\",\"+254504631681\",\"Salary\"\n" + "\"23000\",\"AED\",\"3\",\"Jeffrey Tabios\",\"+254504631680\",\"Salary\"" val outputStream = context.contentResolver.openOutputStream(uri) outputStream?.let { it.write(data.toByteArray()) it.close() }
Could you please have a look.
Best Regards, Aydin.
The text was updated successfully, but these errors were encountered:
Sorry for the delay. I can't really read that code. Can you make the one that fails more simple?
Sorry, something went wrong.
No branches or pull requests
I'm creating a new csv document in device's Downloads folder with below usage:
Most probably I'm doing something wrong because the data does not get written into the file.
But when I write with OutputStream instead of csvProcessor then it works fine
Could you please have a look.
Best Regards,
Aydin.
The text was updated successfully, but these errors were encountered: