Here is my code
Glide.with(getContext())
.asBitmap().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE)
.load(url)
.into(new SimpleTarget<Bitmap>(250, 250) {
@Override
public void onResourceReady(Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
progressBar.setVisibility(View.GONE);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "Share");
String path = MediaStore.Images.Media.insertImage(getContext().getContentResolver(), resource, "", null);
Uri screenshotUri = Uri.parse(path);
intent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
intent.setType("*/*");
startActivity(Intent.createChooser(intent, "Send to"));
}
@Override
public void onLoadFailed(Drawable errorDrawable) {
progressBar.setVisibility(View.GONE);
Toast.makeText(getContext(), "Something went wrong", Toast.LENGTH_SHORT).show();
super.onLoadFailed(errorDrawable);
}
@Override
public void onLoadStarted(Drawable placeholder) {
progressBar.setVisibility(View.VISIBLE);
Toast.makeText(getContext(), "Sharing", Toast.LENGTH_SHORT).show();
super.onLoadStarted(placeholder);
}
});
I am implementing share option in my android application using Url. The Url contains all types of files like PDF,PNG,DOC,DOCX,etc,...I tried to share PNG file among other apps and its working fine.
The issue is I cannot able to share pdf and other format files except image.
Please help me to share all the MIME TYPE files
question from:
https://stackoverflow.com/questions/65640861/android-how-to-share-pdf-xis-doc-png-from-url 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…