-1
我正在嘗試共享GIF文件。我想通過任何社交網絡應用程序分享它,我有一個文件名的問題。我不知道如何獲取名稱文件。這是我的代碼:使用Glide共享文件
llsetwallpapers.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// set as wallpapers
lt.setText("Please Wait ...");
lt.setTranslationY(100);
lt.show();
Glide.with(getApplicationContext())
.load(url)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<?super Bitmap> glideAnimation) {
File file = new File file = new File(getApplicationContext().getExternalCacheDir() , namefile)
file.setReadable(true);
Uri uri = Uri.fromFile(file);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/gif");
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(shareIntent, "Share with"));
}
});
}
});