I am reading a vector image from a XML resource and showing it in an ImageView. It's Ok. Now, I need to pass the image to an Intent using intent.putExtra. Question: How can I convert the vector XML to a bitmap or get the image from the ImageView? I tried .getDrawingCache(), .getDrawable, getImageMatrix, etc, but it does not work.
Tried this way:
String path = MediaStore.Images.Media.insertImage(getApplicationContext().getContentResolver(),
imgPrevisao.getDrawingCache(),
"Minha previsão",null);
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("image/*");
sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(path)) ;
getApplicationContext().startActivity(Intent.createChooser(sharingIntent, "Share with"));
And this way:
Intent intent = new Intent( Intent.ACTION_SEND );
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra( Intent.EXTRA_TEXT, textoPrevisao );
intent.putExtra( Intent.EXTRA_STREAM, imgPrevisao.getDrawingCache() );
intent.setType( "image/*" );
startActivity( intent );
TIA,
André Corrêa