أعلان الهيدر

الاثنين، 21 مايو 2018

الرئيسية الدرس 37: انشاء تطبيق بمجموعة من الصور مع امكانية مشاركتها

الدرس 37: انشاء تطبيق بمجموعة من الصور مع امكانية مشاركتها



Bitmap bitmap= BitmapFactory.decodeResource(getResources(),R.drawable.my_image);
String path = getExternalCacheDir()+"/shareimage.jpg";
java.io.OutputStream out = null;
java.io.File file=new java.io.File(path);
try { out = new java.io.FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } path=file.getPath();
Uri bmpUri = Uri.parse("file://"+path);

Intent shareIntent = new Intent(); shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); shareIntent.setType("image/jpg"); startActivity(Intent.createChooser(shareIntent,"Share with"));

ليست هناك تعليقات:

إرسال تعليق

يتم التشغيل بواسطة Blogger.