Android - New intent with captured Image - android

I am developing an android app. When I capture an image using the code
Intent intent = new Intent(MediaStore.ActionImageCapture)
it will be stored in my sdcard as well as it will be displayed in the ImageView. Next, on button ‘Crop Picture’ click event, it should open the captured image as a new intent with the crop feature.
I've code to open the Gallery and select the captured image with the crop feature, but I don’t want the Gallery to get opened, instead I want the captured image in new intent with crop features.
Could anyone please assist?

In this case What you should do is, when it goes to next activity, save the image in local device, and put the image location as a intent value. Then when the new activity start, onCreate method, get the image location from intent values and load the image from the saved location. then delete the saved image.
If you can wait for few hours, I can put the code here.Feel free to ask anything until you get what you want.
Cheers!!

Related

How to draw on a photo IMMEDIATELY after taking it, THEN save to storage

I have searched around and found a few different solutions to this problem but none of them are really what I am looking for.
I am developing an app that lets the user take an image by opening the camera via a MediaStore.ACTION_IMAGE_CAPTURE Intent as so...
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
And then saves the image with
File photo = new File(Environment.getExternalStorageDirectory(), titleOfPhoto + ".jpg");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
I even get the thumbnail back and display it for the user in the onActivityResult() Override.
As the title suggests, what I would like to do is allow the user to draw on the captured image immediately after taking it. But I have no control over what happens between opening the camera and returning to my app with the captured image already saved. Apps like SnapChat and WhatsApp are doing exactly this and so much more, so I know it is possible, but Android does not appear to have this capability built in.
To be clear: The sequence of events needs to be
1) Open the camera
2) Take a picture
3) Draw on the picture
4) Press 'Ok'/'Done' or something
5) Save the edited photo
6) Return thumbnail
Is there anyway to add an event listener to the camera, or open the camera in a different manner that gives more control? Any help is appreciated! Thanks!
In order to do this, you will have to use the Camera Framwork API.
The basic of this is to render the camera output on a Surface View in your app. Then when the user takes a picture, capture the state of the surface view. From there you can allow your users to draw on the picture. When they are finished, THEN save the picture and display its thumbnail.

Opening image in Gallery app programatically shows low resolution

I download and save an image on button click in my app. This works fine. If I view this image via the Gallery app (or any other way) it looks fine.
However, if I try to open the image with:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(imageFile), "image/*");
startActivity(intent);
It prompts me what app I want to open the file with (Gallery or Photos). If I select Gallery, the image opens but is very low resolution. As the photo contains a lot of text, it makes it so you can't zoom in and read. If I select "Photos", it looks fine.
Is there anything I can do to make it work fine in Gallery?
So I was saving the image with no extension. As it was opening in Gallery I figured it knew it was an image, but as soon as I added ".jpeg" to the file name, it showed in correct resolution. Strange bug, figured I'd update just in case someone else was hoping to find an answer here at some point.

store,then send the image from camera to other activity

Hi in my page there are three option to make the picture to display in the another activity. option one memory card,camera,horizontal list view of images. From this what ever the user may choose but the image should be displayed in the next activity image view. Please guide me to do further !! am just open the camera and the memory card and after that i dont know how to send it to next activity.
Basically, you need to pass the information of the image to the next activity using Intent.
You should use:
Intent intent = new Intent(firstActivity.this, secondActivity.class);
intent.putExtra("fileName","SEE_BELOW");
startActivity(intent);
Option A:
if you are using an image from SDcard - replace SEE_BELOW with the actual String of the image Path.
Option B:
if you are getting the image from a ListView - use the arg2 in the onItemSelected method to get the position selected in the list and pull the image from there, save it to SD, and sending the String path like in Option A.
Option C:
if you are getting the image from the camera - I would save the image to SD, and then send the String path via Intent like in Option A.
Now, in your SecondActivity, in the onCreate method you call:
Intent intent = getIntent();
String image = intent.getStringExtra("fileName");
Now in your image variable you have the address of the image - just set it to your imageView and you are done!

how to upload image captured from camera in an android app

in my app i have placed a button called Add Photo, when the user clicks the button a pop up menu appears with 2 option camera and library. When i select library i am able to move to the photo album of the device. Following is the code which i am using to go to the mobile library
public void library()
{
Intent myIntent = new Intent(Intent.ACTION_PICK);
myIntent.setType("image/*");
startActivityForResult(myIntent, 1);
}
whatever image i click there i want it to be uploaded in an url,
in the same way the image which i capture through the camera also want to be uploaded in an url.
how to do this is there any API or example code pls help me
This SO answer explains how to get the true path of the image in your onActivityResult
How to pick an image from gallery (SD Card) for my app?
Then look for an example on how to upload a file using http, any Java example ought to work, for instance:
http://www.jguru.com/faq/view.jsp?EID=62798

How to capture an image and set it as attachment from an application?

I want to launch the camera from my application and want to use the captured image as an attachment in my application.
The use case is as below:
Press the capture button in the application->Opens camera application -> capture an image->the image is shown as thumbnail in my application.
Any suggestions, ideas, would be very helpful.
Image capture step description:
Get Path of image from ACTION_IMAGE_CAPTURE Intent
After that, you have path of the fetched image. Then you can use it for your purpose. Show it as small Bitmap, and attach the original to further processing.
To view captured image, send the intent
Intent viewImageIntent = new Intent();
viewImageIntent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File(imageFilePath);
viewImageIntent.setDataAndType(Uri.fromFile(file), "image/*");
viewImageIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(viewImageIntent);

Categories

Resources