PDA

View Full Version : ایجاد قابلیت اشتراک گذاری عکس در شبکه‌های اجتماعی



asefy2008
دوشنبه 12 بهمن 1394, 17:23 عصر
سلام
چطور میشه قابلیت اشتراک گذاری عکس در شبکه‌های اجتماعی ایجاد کرد؟مانند فیس‌بوک، توییتر، فلیکر، تامبلر و Foursquare

Omid Zakeri
دوشنبه 12 بهمن 1394, 23:23 عصر
سلام
میتونی از این کد استفاده کنی



public void onShareItem(View v) {
// Get access to bitmap image from view
ImageView ivImage = (ImageView) findViewById(R.id.img_company_logo);
// Get access to the URI for the bitmap
Uri bmpUri = getLocalBitmapUri(ivImage);
if (bmpUri != null) {
// Construct a ShareIntent with link to image
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
shareIntent.putExtra(Intent.EXTRA_SUBJECT, about.getCompany_Title());
shareIntent.putExtra(android.content.Intent.EXTRA_ TEXT,
about.getContent_about());
shareIntent.setType("image/*");
shareIntent.setType("text/plain");

// Launch sharing dialog for image
startActivity(Intent.createChooser(shareIntent, getResources().getString(R.string.share)));
} else {
// ...sharing failed, handle error
}
}




البته من خودم این کد رو از p30droid.com (http://p30droid.com)
گرفتم