Как отправить файл CSV через намерение - PullRequest
0 голосов
/ 28 февраля 2020

Это функция для запуска намерения общего ресурса. При открытии окна Shaaring the share открывается окно, и я могу выбрать все параметры, такие как WhatsApp, Gmail, при выборе этого параметра файл не прикрепляется

private void OpenShare(String filename) {


        Uri uri = Uri.parse(( getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getPath()+filename));


        Intent sharingIntent = new Intent();
        sharingIntent.setAction(Intent.ACTION_SEND);
        sharingIntent.setDataAndType(uri, "text/*");
        startActivity(Intent.createChooser(sharingIntent, "share file with"));



    }

Поле Share открытие, пожалуйста, помогите мне решить это

сообщение об ошибке

2020-02-28 20:09:19.821 14722-14903/com.digicita.digiflow E/ActivityThread: Failed to find provider info for cn.teddymobile.free.anteater.den.provider
2020-02-28 20:09:20.719 14722-14821/com.digicita.digiflow E/Parcel: Reading a NULL string not supported here.
2020-02-28 20:09:21.484 14722-14722/com.digicita.digiflow E/Parcel: Reading a NULL string not supported here.
2020-02-28 20:09:24.422 14722-14722/com.digicita.digiflow E/ANR_LOG: >>> msg's executing time is too long
2020-02-28 20:09:24.422 14722-14722/com.digicita.digiflow E/ANR_LOG: Blocked msg = { when=-2s378ms what=100 target=android.app.ActivityThread$H obj=ActivityRecord{40b44d2 token=android.os.BinderProxy@67a38f1 {com.digicita.digiflow/com.digicita.digiflow.MainActivity}} } , cost  = 2328 ms
2020-02-28 20:09:24.422 14722-14722/com.digicita.digiflow E/ANR_LOG: >>>Current msg List is:
2020-02-28 20:09:24.422 14722-14722/com.digicita.digiflow E/ANR_LOG: Current msg <1>  = { when=-2s350ms what=101 target=android.app.ActivityThread$H obj=com.android.internal.os.SomeArgs@43079a3 }
2020-02-28 20:09:24.423 14722-14722/com.digicita.digiflow E/ANR_LOG: Current msg <2>  = { when=-2s325ms what=109 target=android.app.ActivityThread$H arg1=1 obj=android.os.BinderProxy@929e1d }
2020-02-28 20:09:24.423 14722-14722/com.digicita.digiflow E/ANR_LOG: Current msg <3>  = { when=-1s845ms what=103 target=android.app.ActivityThread$H obj=com.android.internal.os.SomeArgs@4c5a4a0 }
2020-02-28 20:09:24.423 14722-14722/com.digicita.digiflow E/ANR_LOG: Current msg <4>  = { when=-1s845ms what=137 target=android.app.ActivityThread$H arg1=1 obj=android.os.BinderProxy@67a38f1 }
2020-02-28 20:09:24.423 14722-14722/com.digicita.digiflow E/ANR_LOG: Current msg <5>  = { when=-1s468ms what=0 target=android.os.Handler callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 }
2020-02-28 20:09:24.424 14722-14722/com.digicita.digiflow E/ANR_LOG: Current msg <6>  = { when=-1s402ms what=0 target=android.os.Handler callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 }
2020-02-28 20:09:24.424 14722-14722/com.digicita.digiflow E/ANR_LOG: Current msg <7>  = { when=-1s162ms what=0 target=android.os.Handler callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 }
2020-02-28 20:09:24.424 14722-14722/com.digicita.digiflow E/ANR_LOG: Current msg <8>  = { when=-1s100ms what=0 target=android.os.Handler callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 }
2020-02-28 20:09:24.424 14722-14722/com.digicita.digiflow E/ANR_LOG: Current msg <9>  = { when=-1s92ms what=0 target=android.os.Handler callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 }
2020-02-28 20:09:24.425 14722-14722/com.digicita.digiflow E/ANR_LOG: Current msg <10>  = { when=-1s84ms what=0 target=android.os.Handler callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 }
2020-02-28 20:09:24.425 14722-14722/com.digicita.digiflow E/ANR_LOG: >>>CURRENT MSG DUMP OVER<<<
2020-02-28 20:09:38.731 14722-14722/com.digicita.digiflow E/Parcel: Reading a NULL string not supported here.
2020-02-28 20:09:47.514 14722-14722/com.digicita.digiflow E/Parcel: Reading a NULL string not supported here.
2020-02-28 20:10:19.139 14722-14722/com.digicita.digiflow E/Parcel: Reading a NULL string not supported here.
2020-02-28 20:14:01.323 14722-14722/com.digicita.digiflow E/Parcel: Reading a NULL string not supported here.
2020-02-28 20:14:24.794 14722-14722/com.digicita.digiflow E/Parcel: Reading a NULL string not supported here.

1 Ответ

0 голосов
/ 13 марта 2020

Добавьте следующий код к фильтру намерений в манифесте.

 <data android:mimeType="text/comma_separated_values/csv" />

И измените тип MIME на text/plain, text/csv или text/comma-separated-values.

...