Reputation: 1670
is there any way to do this? I followed this tutorial (http://marakana.com/forums/android/examples/39.html) and it works great. In addition I put the FrameLayout (that contains the camera preview) into a RelativeLayout with an ImageView.
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<FrameLayout
android:id="@+id/preview"
android:layout_width="330dp"
android:layout_height="233dp"
android:layout_marginTop="22dp"
android:layout_alignBottom="@+id/imageView1"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" >
</FrameLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image_on_preview" />
</RelativeLayout>
So now starting the application I have the camera and an imageview on that. If I save the picture to the SD card I get only the picture taken with the camera but the imageview does not appear (of course, why would appear). Now my question how can I save it as well? For better understanding I captured a screen shot when I use my application.
So I would like to save the both the camera preview and the imageview as well in one picture. I am not sure if it is possible, but the if I didnt have to save the pics onto the sd card it would be the best. I will add a button "save to SD card" later to save it.
**Update
Now I figured out a way. I save the picture on SD card then when the file created I change to another intent. It contains two imageviews, the "image_on_preview" and the other that has the source where I saved the picture before. Okay now I just have to somehow get tricky and combine the two imageviews :)
***Update2
Okay, I did it. In the second activity I convert both imageviews to bitmaps. Then I draw a Canvas and it puts them on each other, then I can save it directy to the SD card.
Upvotes: 3
Views: 1864
Reputation: 1670
Since nobody answers and I solved the problem (and there is one vote up ) I show my own method.
canvas.drawBitmap()
. I drew the captured photo first than the imageview (the cover), and place/scale them to look just like in the activity. The canvas will draw the bitmap and you can save it to the sd card.
5* (may be skipped) Delete the first picture.Hope this will be useful to someone :)
Upvotes: 3