Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending image through intent  RSS feed

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i wrote a program in which my images are read from sdcard and shown in as a gridview and when clicked on any image on the gridview , bigger image opens in another activity , i have also added a share button to share my image to different applications example whatsapp , so when i click on share , a chooser popsup and i also reach safely inside whatsapp where i select a user but when i select a user my image is not shown , below is the picture of the screen after i select a user

My code for the above

public class FullScreenImageAdapter extends PagerAdapter {

private Activity _activity;
private ArrayList<String> _imagePaths;
private LayoutInflater inflater;
Intent intent, chooser;

// constructor
public FullScreenImageAdapter(Activity activity,
ArrayList<String> imagePaths) {
this._activity = activity;
this._imagePaths = imagePaths;

public int getCount() {
return this._imagePaths.size();

public boolean isViewFromObject(View view, Object object) {
return view == ((RelativeLayout) object);

public Object instantiateItem(final ViewGroup container, int position) {
TouchImageView imgDisplay;
final Button btnClose, btnShare;

inflater = (LayoutInflater) _activity
View viewLayout = inflater.inflate(R.layout.layout_fullscreen_imag,
container, false);

imgDisplay = (TouchImageView) viewLayout.findViewById(;
btnClose = (Button) viewLayout.findViewById(;
btnShare = (Button) viewLayout.findViewById(;

BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(_imagePaths.get(position),

btnShare.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub
intent = new Intent(Intent.ACTION_SEND);
Uri imageuri = Uri.parse("file://sdcard//Pictures//raw "
+ _imagePaths);
intent.putExtra(Intent.EXTRA_STREAM, imageuri);
chooser = Intent.createChooser(intent, "Share image via....");


((ViewPager) container).addView(viewLayout);

return viewLayout;
i need to know where i am going wrong and please give suggestions thanking you
[Thumbnail for 2014-11-18-15.09.30.png]
Posts: 42975
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds as if there are two problems - an image not being show in a View, and sharing the image not working. If this was my problem, I'd separate the issues and debug them one by one, starting with the problem of the image not being shown in the view.

You could starting by making sure that the "bitmap" object is indeed a valid image - maybe save it to a file and make sure you can view it.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!