Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6942901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:05:10+00:00 2026-05-27T13:05:10+00:00

I created a layout where my surface view has been resized from the original

  • 0

I created a layout where my surface view has been resized from the “original size”, I did the following:

    ViewGroup.LayoutParams params = mSurfaceView.getLayoutParams();
    int mPixels=getResources().getDimensionPixelSize(R.dimen.profile_pic_dimension); //200
    params.width=mPixels;
    params.height=mPixels;
    mSurfaceView.setLayoutParams(params);
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

and I obtain a view like this:
http://img412.imageshack.us/img412/9379/layoutp.png

but then.. whenever I take the picture.. it doesn’t saves as how I can see it on the view… but instead it saves it normal size like if the view was taking the whole screen (like if the surfaceview was never resized).

I tried using this:

Camera.ShutterCallback mShutterCallback = new Camera.ShutterCallback() {
    @Override
    public void onShutter() {
        Camera.Parameters p = mCamera.getParameters(); 
                p.setPictureSize(mSurfaceView.getWidth(), mSurfaceView.getHeight()); 
               mCamera.setParameters(p); 
        }
    };

but still didn’t get the image size i wanted to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:05:10+00:00Added an answer on May 27, 2026 at 1:05 pm

    You cannot just supply any width and height value when setting the picture (or preview) size. In stead, you’ll have to use one of the items from the list of supported sizes, which you can retrieve by calling getSupportedPictureSizes() (there’s an equivalent for the preview).

    So far I haven’t come across any devices that support taking square pictures, so after a 4:3, 16:9, 16:10, or whatever ratio, picture has been taken, you will have to ‘cut’ out the relevant part yourself, and optionally scale it down to a specific dimension. Probably the most straightforward way to do this, is by creating a new Bitmap as a subset from a source Bitmap (and then optionally scale it down). In order to get the source bitmap, you’ll likely need to hook up a PictureCallback to the camera with takePicture(...).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have created following layout. <TableLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal > <TableRow> <TextView android:layout_width=fill_parent android:layout_height=wrap_content
I've created a layout.xml file with the following XML, but I can't get the
I've created a layout with an image view and a web view. The web
Hi all I have created layout using following code <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have a Custom ListView created from XML Layout. I want to bind that
I create a game which has a custom view derived from surfaceView. and in
I created this layout of successive text input fields, 1- Enter data into empty
I've created a dummy layout for my latest design, but when I resize the
I've created accordion like this: layout:'accordion', layoutConfig:{ animate:true } then i add elements by
I called my main activity Main, and Eclipse created Main.java and res/layout/main.xml for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.