Paolo,
I think I understand what your problem is. I had similar problems and
I solved it with this code. It's probably bad programming, so please
use it only as a temporary solution, just to see if this where your
problem originates. Note the switching of width and height.
public void surfaceChanged(SurfaceHolder holder, int format, int
width,
int height) {
if (mPreviewRunning) {
mCamera.stopPreview();
}
Camera.Parameters p = mCamera.getParameters();
/*
* this is where we switch width and height. Probaly a
bad idea, just try it
* to see if it solves your problem and then find the
proper solution. And
* please post it here
*/
if (width > height) {
p.setPreviewSize(width, height);
} else {
p.setPreviewSize(height, width);
}
mCamera.setParameters(p);
try {
mCamera.setPreviewDisplay(holder);
} catch (IOException e) {
e.printStackTrace();
}
mCamera.startPreview();
mPreviewRunning = true;
}
On 23 apr., 17:48, "~ TreKing" <[email protected]> wrote:
> On Fri, Apr 23, 2010 at 10:32 AM, Paolo <[email protected]> wrote:
> > My activity use the Camera, so i must to fix the activity in landscape,
> > otherwise the preview doesn't work correctly...
>
> I haven't used the camera, so I have no idea how it works, but are you sure
> you HAVE to fix it to landscape?
>
> > Do you have in mind "Layar"? They have been able to do that. Please try it
> > to undestand.
>
> I just tried their app and as far as I can tell it's just letting Android do
> it's orientation thing while keeping the camera preview open.
>
> So in this scenario, my problem are 2:
>
>
>
> > 1) how to rotate an Option Menu.
> > 2) How to rotate my layout. Maybe I will do a custom view....
>
> I think your main problem is: How to use the camera without fixing your view
> to landscape. Sorry, I don't have an answer for you though. Maybe someone
> who has used the camera will?
>
> -------------------------------------------------------------------------------------------------
> TreKing - Chicago transit tracking app for Android-powered
> deviceshttp://sites.google.com/site/rezmobileapps/treking
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group
> athttp://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en