I am working in one Application where i can share my gallery image to facebook,twitter
i have searched the some links..Where everybody mentioned as intent service..but i do not know how it will use in my application,i would really be thankful if somebody help me with complete code
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
share.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file:///sdcard/DCIM/Camera/myPic.jpg"));
startActivity(Intent.createChooser(share, "Share Image"));
Try this code:
Button button = (Button)findViewById(R.id.facebookButton);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String path = "path to the image";
Uri imageUri = Uri.parse(path);
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sharingIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
sharingIntent.setType("image/png");
startActivity(Intent.createChooser(sharingIntent , "Send image using.."));
}
});