I created surface that have grid. After adding on it some objects(circle, photos) I want to share it without grid. Can anyone help me to solve my problem. Here is my code and see my surface with grid attached. surfaceview.
artBoard.setDrawingCacheEnabled(true);
Bitmap b = artBoard.getDrawingCache();
String pathofBmp = MediaStore.Images.Media.insertImage(getContentResolver(), b,"title", null);
Uri bmpUri = Uri.parse(pathofBmp);
final 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/png");
startActivity(shareIntent);
artbord is my surfaceview.
Related
I am getting an error that i cannot attach empty file in gmail.I am trying to build simple app in which when i click on the button it show choices by which i can send image,But the below code is not working.
Please help i am novice in android.
code:
if(view.getId()==R.id.SendImage)
{
Uri imageUri = Uri.parse("android:resource://com.example.jaspreet.intentstest.drawable/"+R.drawable.image);
intent=new Intent(android.content.Intent.ACTION_SEND);
intent.setType("application/image");
intent.putExtra(Intent.EXTRA_STREAM,imageUri);
intent.putExtra(Intent.EXTRA_TEXT,"Hey i have attached this image");
chooser=Intent.createChooser(intent,"Send Image");
startActivity(chooser);
}
Try using this:
shareIntent.setType("image/png");
By using this the intent know that it will send .png file.
On this link you can find a list of all media type/subtypes
Try this
Bitmap b =BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = MediaStore.Images.Media.insertImage(getContentResolver(),
b, "Title", null);
Uri imageUri = Uri.parse(path);
share.putExtra(Intent.EXTRA_STREAM, imageUri);
startActivity(Intent.createChooser(share, "Select"));
Try this snippet
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
share.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://" + C.PROJECT_PATH + "/drawable/" + R.drawable.icon_to_share);
startActivity(Intent.createChooser(share, "Select"));
An android:resource:// is not a File, and probably you are messing up your Uri by converting to a File and then back to a Uri.
Hello I try to use the share dialog using Intent with the code below. I want to share an image and text at the same time. However I get the eror: Failed to insert image java.io.FileNotFoundException: No such file or directory
My code is as below, am I doing anything wrong. The code is in a fragment class.
Bitmap image = bmResized;
String pathOfBmp = Images.Media.insertImage(getActivity().getContentResolver(), image, "twitter_image.jpg", null);
Uri bmpUri = Uri.parse(pathOfBmp);
Intent tweetIntent = new Intent(Intent.ACTION_SEND);
tweetIntent.setAction(Intent.ACTION_SEND);
tweetIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
tweetIntent.putExtra(Intent.EXTRA_TEXT, "here is the tweet text");
tweetIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
tweetIntent.setType("image/jpeg");
startActivity(Intent.createChooser(tweetIntent, "Share this via"));
You can look Fabric library. For twitter process usually using Fabric library.
You can look Fabric document:
https://docs.fabric.io/android/twitter/compose-tweets.html
Also this is github link:
https://github.com/fabric/fabric
Try this:
Drawable mDrawable = mImageView.getDrawable();
Bitmap mBitmap = ((BitmapDrawable) mDrawable).getBitmap();
String path = MediaStore.Images.Media.insertImage(getContentResolver(), mBitmap, "Image Description", null);
Uri uri = Uri.parse(path);
Intent tweetIntent = new Intent(Intent.ACTION_SEND);
tweetIntent.setType("image/jpeg");
tweetIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(tweetIntent, "Share this via"));
I'm trying to share an image of type PNG using G-mail. But in mail attachment I'm getting JPG.
final Bitmap selectedRowToBmp = BitmapFactory.decodeResource(getResources(), R.drawable.share_image);
if (selectedRowToBmp != null) {
String pathofBmp = Images.Media.insertImage(hostActivity.getContentResolver(), selectedRowToBmp, null, null);
Uri bmpUri = Uri.parse(pathofBmp);
final Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("image/png");
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
}
Any Help will be appreciated.
I need to share url and image on facebook wall using intent. If I'm sharing both, only image is getting shared because in intent setype I'm using "image/*". Below are the code snippet
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/*");
String imagePath = Environment.getExternalStorageDirectory()+"/sample_image.png";
File imageFileToShare = new File(imagePath);
Uri uri = Uri.fromFile(imageFileToShare);
shareIntent.putExtra(Intent.EXTRA_TEXT, "URL goes here");
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(shareIntent);
I need to share both url and image. Can anyone help me to solve this issue?
When I captured full screenshot image, it was fine quality in gallery.
But when I share that image in my app, then receive other phone, it was broken.
Code has no problem because the same problem was happened in gallery share button. I use this code in my application
String Path = Environment.getExternalStorageDirectory().toString();
Uri uri = Uri.fromFile(new File(Path, "/Screenshot_20141105"+".jpg"));
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.setType("image/jpeg");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "good"));
How can I solve this problem
try this
String Path = Environment.getExternalStorageDirectory().toString();
File file=new File(Path, "/Screenshot_20141105"+".jpg");
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/*");
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file.getAbsolutePath()));
startActivity(Intent.createChooser(share, "Share Report"));
Uri class implements from Parcelable, so you can add and extract it directly from the Intent.