6
Chúng ta có thể mở hộp thoại phần sử dụng ACTION_SEND để chia sẻ văn bảnSharing Text File sử dụng ACTION_SEND
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "Download Link: Android play store link");
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Share This App"));
Làm thế nào tôi có thể sử dụng ACTION_SEND để chia sẻ một tập tin văn bản.
Tôi đọc http://developer.android.com/training/sharing/send.html nhưng không thể tìm cách chia sẻ tệp văn bản.
Điều này sẽ không hoạt động trên các cấu hình khác nhau. Bạn nên chia sẻ nội dung với một ContentProvider thay vì http://developer.android.com/training/enterprise/app-compatibility.html#sharing_files – rds
... Uri.fromfile (... cú pháp là sai, thay đổi nó thành Uri.fromFile ( –
Đây là cách sạch nhất và đơn giản nhất mà tôi tìm thấy sau nhiều lần xuất hiện và các ví dụ khác. Trường hợp của tôi: Ứng dụng của tôi tạo tệp .csv và lưu nó trong thư mục TẢI XUỐNG, và tôi muốn chia sẻ nó sau khi tệp được tạo mà không cần sử dụng FileProvider. –