Je lis une image vectorielle à partir d'une ressource XML et l'affiche dans un ImageView. C'est bon. Maintenant, je dois passer l'image à un Intention avec intention.putExtra. Question: Comment puis-je convertir le vecteur XML en bitmap ou obtenir l'image à partir d'ImageView? J'ai essayé .getDrawingCache(), .getDrawable, getImageMatrix, etc, mais cela ne fonctionne pas.Comment faire pour récupérer un bitmap à partir d'une image vectorielle dans une ressource XML
Essayé de cette façon:
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"));
Et cette façon:
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
Quelque chose comme ça devrait fonctionner. Opération assez standard pour récupérer un bitmap à partir d'une vue d'image. – greenapps
Cette intention devrait être traitée dans votre application? – j2ko
greenapps, désolé, quelque chose comme quoi? Je suis nouveau avec Android en développement. –