Getting a non-stretched Camera Preview Screen

by TrojanSnake12 » Wed, 10 Jun 2009 08:30:13 GMT

Sponsored Links
 Hi all,

I am trying to make an activity that (among other things) shows a
camera preview screen.  I have a translucent ImageView on top of the
camera preview, which is unstrechted.  The height is 295, so the width
should be ~400 pixels.  Unfortunately, no matter what I seem to do, I
cannot get the Preview I have (which is almost identical to the
apidemo camera preview View) to maintain a 4:3 view.  Instead, it is a
480x295 view, which produces undesirable horizontal stretches in the
preview.  None of my specifications of fixed sizes in the
SufraceHolder or the setPreviewSize() of the camera object make any
difference whatsoever.  I just want the camera preview to be 400x295,
with 40px margins on the left and the right of the screen so that it
is centered in teh same place as the image view.

Right now, I am stretching out the ImageView to the full screen so
they at least match, but ideally I would like to have vertical black
bars on the left and right edges of the screen to get more accurate

Other Threads

1. EditText field not update, how to do this?


I have an EditText field and a button.
My aim is to let user enter text info to the EditText or click the
button to launch a dialog to select some checkbox and radio button
which it will perform some computation and return a value to display
at the EditText field.

I can't seems to get the value to display at the EditText field after
the dialog dismiss. I did try a toast to display the value and it is
I *think* the view was not refresh to display the text in the EditText

Can anyone tell me roughly how to do this?



2. Same SMS is received multiple times- HTC Tattoo

Hi All,

I am facing one issue on my HTC tattoo device.

I have written a code which sends an SMS to the given number. At the
recipient end I am receiving more than one SMSs. One time I have even
received 17 same messages.

I am posting the code snippet for the reference-

private void sendSMS(final String phoneNumber, final String message) {
                Log.i("Send To Friend", "sendSMS");
                SmsManager sms = SmsManager.getDefault();
                sms.sendTextMessage(phoneNumber, null, message, null, null);
                Toast.makeText(this, "Message has been sent", 

Please help in this regard.


3. Is MapController's zoomToSpan() execution deferred?

4. Goodbye friends and thanks for all the help.

5. Porting Android 2.0 on Samsung 360 M1

6. Memory problem with UI elements

7. Launch Local Drawable Resource in the Gallery app Using Intents