Android :: Camera Preview - Strange Lines On 1.5 Version Of Sdk
Jan 13, 2010
I am developing the camera module for an android application. In main application when user clicks on 'take picture' button, new view with SurfaceView control is opened and camera preview is shown. When users click on dpad center, camera takes picture and save it to the disc. Pretty simple and straightforward.
Everything works fine on my device - HTC Tattoo, minsdkversion 1.6...but when I tested application on HTC Hero minsdkversion 1.5, when camera preview is shown,some strange lines occur. altough preview is crashed, taking of pictures works fine
Here is the picture:
View 3 Replies
Jul 9, 2010
In my activity I show the camera preview on a surfaceView. It works perfectly fine on Nexus One and HTC Desire, but on Samsung Galaxy S I see strange lines, weird proportions and everything three times. see the Screenshot below.
The issue seems to be similar to this one: http://stackoverflow.com/questions/2053440/camera-preview-on-androd-strange-lines-on-1-5-version-of-sdk but none of the comments there helped. I tried to swap height,width for the camera parameters, but not much of a difference.
(Side note: my activity is always in landscape mode, fixed. I have that fix in my manifest as screenOrientation parameters, in case that matters somehow).
The code of my SurfaceHolderCallback (the relevant inner class in my activity):
CODE...................
View 2 Replies
View Related
Jul 9, 2010
In my activity I show the camera preview on a surfaceView. It works perfectly fine on Nexus One (2.1update1, 2.2) and HTC Desire (2.1update1), but on Samsung Galaxy S (2.1update1) I see strange lines, weird proportions and everything three times. see the screenshot http://img249.imageshack.us/img249/7466/device1s.png
The issue seems to be similar to this one: [url] but none of the comments there helped. I tried to swap height,width for the camera parameters, but not much of a difference.
My activity is always in landscape mode, fixed. I have that fix in my manifest as screenOrientation parameters, in case that matters somehow).
CODE:..................
Full code of my SurfaceHolderCallback (the relevant inner class in my activity) http://pastebin.com/YmcwEVn8.
View 4 Replies
View Related
Nov 21, 2010
I'd like my app to run on both Android versions 2.1 and 2.2. In one area of my app, there is a portrait-style camera - the process for producing a portrait camera preview is different (as far as I know) on the two OS versions. Here is how:
2.1:
Camera.Parameters parameters = camera.getParameters();
parameters.set("orientation", "portrait");
camera.setParameters(parameters);
2.2:
camera.setDisplayOrientation(90);
The setDisplayOrientation(int) method became available in API Level 8 (2.2) and, so, cannot be used on 2.1; however, using the 2.1 (Camera.Parameters) method does not rotate the preview and image correctly on 2.2. It seems odd that this incompatibility exists - is there a more correct way to do this that will allow me to target both platforms?
View 1 Replies
View Related
Aug 19, 2010
I am trying to display a filtered version of the camera preview.
The code runs without errors but the device is showing the preview instead of the generated bitmap.
This is the code for my (very small) Activity: http://code.google.com/p/ruellia/source/browse/ruellia/src/br/com/ximp/ruellia/RuelliaActivity.java
I suspect the view layering and the surface holder type, but so far no luck... anyone?
View 1 Replies
View Related
Aug 23, 2010
Is there a simple line of code that would allow only loading the code if the OS version meets the requirements? Lets say I have my target OS as 2.2 but the min sdk is 3 for android 1.5 so even if i have some code in my project that isn't compatable with 1.5 it will still compile since the target OS is 2.2. Anyway, I want to ad a feature that requires code that's not in the 1.5 SDK and will cause a crash if it's loaded on a 1.5 phone. Is there a simple thing like this that I can do? So i dont have to make the entire app not available to 1.5 users?
if (Android OS == >2.1){
//Insert code here that requires 2.1 and up}
else{
//insert code that would appear is OS is <2.1}
View 4 Replies
View Related
May 26, 2009
I've been trying to develop an application for the android 1.5 sdk version that allows the user to simply recorder a video but it has been a long road. I can record audio with the simple example on the android developers website but when I put the VideoSource and the VideoEncoder lines it gives a 100 error that means that the Camera server died. Here is an example of the code.
recorder.setCamera(mCamera); recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile("/sdcard/dcim/Camera/test.3gp");
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
recorder.prepare(); recorder.start(); ...
Here is the debug error messages:
05-26 11:37:55.331: INFO/ServiceManager(30): service 'media.audio_flinger' died 05-26 11:37:55.331: INFO/ServiceManager(30): service 'media.player' died 05-26 11:37:55.331: INFO/ServiceManager(30): service 'media.camera' died 05-26 11:37:55.331: WARN/MediaPlayer(690): MediaPlayer server died! 05-26 11:37:55.331: ERROR/MediaPlayer(690): error (100, 0) 05-26 11:37:55.331: WARN/Camera(1462): Camera server died! 05-26 11:37:55.331: WARN/Camera(1462): ICamera died 05-26 11:37:55.341: ERROR/MediaPlayer(690): Error (100,0) 05-26 11:37:55.341: INFO/SONGSEARCH(690): album="The Assassination of Jesse James" 05-26 11:37:55.391: INFO/DEBUG(1485): debuggerd: Apr 21 2009 13:42:23 05-26 11:37:55.401: INFO/ActivityManager(60): Displayed activity org.reccamera.com/.camera: 5276 ms 05-26 11:37:55.421: ERROR/Camera(1462): Error 100 05-26 11:37:55.421: WARN/AudioSystem(60): AudioFlinger server died!
View 2 Replies
View Related
Oct 20, 2010
I'm trying to get the camera preview running on my G2.
This is the code I'm testing with, which was taken from the sample code. It is using supplemental code supplied by Wu-Cheng, but its still throwing an error.
CODE:......................
View 14 Replies
View Related
Aug 28, 2010
I have a problem with using the camera of an Android 2.1 phone (HTC Desire), maybe you can help me.
After calling camera.open() DDMS in Eclipse shows the following errors:
CODE:............
Test view in the emulator works fine, but on my phone only a popup is shown where I only can close the application.
View 2 Replies
View Related
Oct 28, 2009
I upgraded to the 2.0 SDK yesterday. Don't know if that has anything to do with it. I can't get the Camera Preview example from the API Demos to work. I get the same error in both my emulator and on my G1:
E/AndroidRuntime( 4758): java.lang.RuntimeException: Fail to connect to camera service.
View 4 Replies
View Related
Jun 30, 2010
Is it possible to capture an image without showing the camera preview?, i have a requirement that i should be able to capture the image from a thread or from a service, without disturbing the foreground application, where i do not want to show the camera preview, but still i want to capture the image in background and store it in the device. So is it possible to do using the Android 2.2 SDK version?
View 3 Replies
View Related
Jun 25, 2009
Anybody know about the camera Api in android.when i used this Api it displayed a black and white grids and a squre moving above it.Anyone know how to get a real time camera preview please help me with some code.
View 2 Replies
View Related
Aug 30, 2010
I have a requirement to Capture the image without showing the Preview.. And i want to do it in the Background as a Service. Is it possible to do that?
View 2 Replies
View Related
Sep 10, 2010
I see a couple of threads on this topic, but none of them seem to answer the question, so, I'm giving it another go...
Very simple idea... I want to some portion of the screen to preview (and shoot) the camera and the other portions of the screen to add my own graphical elements (buttons, colorful frame around the camera preview, etc).
The example that comes with Android fills the screen. The obvious solution (that doesn't seem to be working) is to use my own SurfaceView (rather than the one they do in the example) and have it sitting in my XML. The code (beneath) doesn't crash and reports that it's firing up the camera... it just never renders on the screen.
I have no idea what I'm doing incorrectly. My guess is that it has something to do with the display thread never having the urge to redraw anything after it renders the initial screen, but I even tried adding a button and initiating the camera to render on the surface view upon button click, but that has not provoked it any further.
(most of this code is pulled directly out of the Android sample code, so, I'm sure it's correct. I'm just doing something wrong in how I pull my View in after the fact, I think).
CODE:........................
View 1 Replies
View Related
Feb 24, 2010
In my Application the camera preview is working properly in both in portrait and in landscape mode. No crashes are occurring, but the users are complaining that the crashes are occurring when they are using the same.
View 1 Replies
View Related
Nov 27, 2009
Let's say in my example I am working with SurfaceView for my CameraSurfaceView. I have a few questions, hope you can help me.
1. When this SurfaceView gets created (I assume via final CameraSurfaceView cameraView = new CameraSurfaceView (getApplicationContext()), this will result in a call createSurface() in SurfaceFlinger with format, width and height. Am I correct?
Is this SurfaceView also my UI window if I want to draw anything? I thought if I call setType(PUSH_BUFFER) on this surface, I won't be able to do any drawing on this surface.
2. How does the application pass these information like format, width and height to SurfaceFlinger for the allocation? Is it by using .setFormat, .setFixedSize?
3. How do they methods .setFormat, .setFixedSize related to the surfaceHolder.surfaceChanged() callback?
View 2 Replies
View Related
Nov 24, 2010
So I started with this little write-up. I wanted to try to make an application that will take pictures while running in the background. To start though I wanted an application that once opened would simply take a picture every X seconds. After recreating the classes and methods show in the walk through below I ran into a few problems.
http://itp.nyu.edu/~sve204/mobilemedia_spring10/androidCamera101.pdf
For starters its seems that the onCreate function sets up all the objects for the application, but if you try to take a picture through any other method than onClick (IE directly calling it) the application actually hasn't setup the canvas or the preview yet.
My first question:
Is there any conditional method that you can setup that will wait till all the "onCreate" objects are created and their associated methods are called and finished? How do I wait for the application to finish putting together my surface and starting the cameras preview before automatically starting to take pictures?
My second question:
I am required to have a preview available to take pictures. Is there anyway to push this application to the back (IE running in the background) while still taking pictures? Is drawing to a canvas a requirement? (From what I can tell AFAIK, you are required to have a surfaceholder to start preview, when you put up another screen or application that pauses the current application and closes the surface/canvas you were presenting that preview on). If my understanding is correct on all of this the best I will be able to do is make a 1x1 pixel canvas that will still take up the screen due to the application being in the foreground.
My Third question:
Is there any way around this? Can you still utilize the camera in some fashion without requiring the preview be drawn?
View 1 Replies
View Related
Sep 7, 2010
I've a problem with Camera Preview Zoom. The methods present in Android 2.2, setZoom() is not working to zoom the preview. Is there any another way to do the Zoom in android? I am using the code present in the Android API Demos. Is their any body who has worked on implementing ZoomIn & ZoomOut and got succeed??
View 4 Replies
View Related
Apr 27, 2010
I have yet to try this on an actual device, but expect similar results. Anyway, long story short, whenever I run my app on the emulator, it crashes due to an out of memory exception.
My code really is essentially the same as the camera preview API demo from google, which runs perfectly fine.
The only file in the app (that I created/use) is as below-
CODE:.......
View 1 Replies
View Related
Jun 8, 2009
When camera is launched in portrait mode, the viewfinder screen is 90 degrees rotated and stretched out. I read couple of places that this is a known bug with sdk1 but i am still finding this problem with cupcake. Has anyone having any idea is this issue is fixed in cupcake or in donut? any clues how to move ahead. setOrientation and changing the preview size didn't help. Even I read somewhere Surface flinger class needs change: http://groups.google.com/group/android-framework/browse_thread/thread...
View 3 Replies
View Related
Jun 11, 2009
I am using the code from ApiDemo Camera Preview and it runs fine on my Gphone but the preview is rotated and stretched.
View 8 Replies
View Related
Jan 30, 2009
Does someone know how I can overlay an image over the camera preview?
View 6 Replies
View Related
Mar 5, 2010
I am writing an android 1.5 application which starts just after boot-up. This is a service and should take a picture without preview. This app will log the light density in some areas whatever. I was able to take a picture but the picture was black.
After googling like crazy, i came across a bug thread about it. If you don't generate a preview, the image will be black since android camera needs preview to setup exposure and focus. I've created a surfaceview and listener but the onSurfaceCreated event never gets fired.
I guess the reason is, the surface is not being created visually. I've also seen some examples of calling the camera statically with MediaStore.CAPTURE_OR_SOMETHING which takes a picture and saves in the desired folder with two lines of code but it doesn't take a picture too.
Do i need to use ipc and bindservice to call this function or do you have any suggestion to achieve my goal (taking a picture without preview) and if so, would you give me a small piece of code as example?
View 2 Replies
View Related
Mar 16, 2010
I'm trying the camera preview
This is my code and it doesn't throw any error, but the screen still black, any ideas?
this.setContentView(R.layout.camerapreview);
SurfaceView cameraSurface = (SurfaceView)findViewById(R.id.cpPreview);
SurfaceHolder holder = cameraSurface.getHolder();
holder.addCallback(this);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
this.camera = Camera.open();
this.camera.setPreviewDisplay(holder);
this.camera.startPreview();}
View 2 Replies
View Related
Jul 19, 2010
I have an app which uses the Camera, sending the preview to a SurfaceHolder. Everything works fine on the HTC Desire that I have been developing on, but when I run it on a Samsung Galaxy S the image from the preview is rotated 90 degrees.
The code attempts to match the best Size returned from the parameters.getSupportedPreviewSizes(), with the width and height of the Surface (as passed into SurfaceChanged as width and height).
(the image is also rotated on the Galaxy when an image is taken from the app). Has anyone else had problems with the preview on the Galaxy? Or better yet got around the problems?
View 1 Replies
View Related
Oct 4, 2009
I am interested in putting some simple graphics (lines, a bit of text, etc) over a live camera preview.
I've looked at the examples, and fiddled around a bunch, but just don't see how to do it.
The examples use a GLSurfaceView as a camera preview surface, but in that mode the view apparently cannot be drawn on. They also fill the whole screen with it. I tried putting it in a normal layout, rather that setting it as the content view, but it does't work.
Anyone know how to: 1) draw graphics over a camera preview when it is the whole view for the activity? 2)do the same thing with a camera preview in a layout shared with other (small) views?
View 3 Replies
View Related
Jan 10, 2010
Our application displays a camera preview and it seems to work fine on all phones except for the Motorola Droid where we get a runtime exception when we set the camera parameters:
CODE:.........
Here is the code for surfaceChanged() which is mostly taken from APIDemos
CODE:......
Does anyone know what is wrong with how we are setting the parameters that would be causing the exception on the Motorola Droid?
View 2 Replies
View Related
Dec 16, 2009
I have a SurfaceView and a GLSurfaceView inside a FrameLayout. The first SurfaceView is used for camera preview, and the GlSurfaceView is for drawing 3D objects that are supposed to be on top of the camera preview.
So natually, I compose the xml like this:
CODE:...........
Unfortunetly, this doesn't work. 3D objects can not be seen. I found later that it only works when the order of the 2 views is reversed, which means:
CODE:..........
The reversed ui works fine, for a while... Everything is OK when the app has a fresh start. But when I press home to go back to the desktop and then click on the icon again to resume the app, 3D objects are gone. Then I reverse the ui again, like before, no 3D objects. But when I press home and then resume the app, they appeared!
My conclusions are: The order of the 2 surface view are wrong in the fresh start, but when the app is resumed from another task, they are set back to their normal order.
View 3 Replies
View Related
Jun 26, 2009
I am trying to set a camera preview in a custom SurfaceView but I get an exception each time I execute the initialization method.
View 4 Replies
View Related
Nov 21, 2009
I have some questions regarding the code below for camera preview application.
1. How does surfaceCreated() and CreateSurface() relate? Is this surface created via createSurface() from SurfaceFlinger client to SurfaceFlinger server? If so, there must be 2 buffers (frame buffers from display driver if there is how acceleration or if it is the emulator, it will be from ashmem) associated with this surface: surface BB (for composition) and surface FB (for display).
2. How does the rendering buffer (frame buffer BB and frame buffer FB) get allocated in the camera preview application? Are they allocated by the application?
3. How does this surface relate to the preview buffers? Are the preview buffers allocated by the Camera Service during startPreview?
private class CameraSurfaceView extends SurfaceView implements SurfaceHolder.Callback {
private SurfaceHolder mHolder; private Camera camera = null;
public CameraSurfaceView(Context context) { super(context);
mHolder = getHolder(); mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
} public void surfaceCreated(SurfaceHolder holder) {
camera = Camera.open(); try {
camera.setPreviewDisplay(mHolder);
} catch (Exception e) { Log.e("Camera", "Failed to set camera preview display", e);
} } }
View 2 Replies
View Related