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
images.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. ItemizedOverlay ArrayIndexOutOfBoundsException

I've seen all the posts about setLastFocusIndex(-1) and I've tried
that.  However, my application is still crashing.  I'm not sure what
to try.  Here's my code

public class UnitOverlay extends ItemizedOverlay {

        private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>
();
        private HashMap<String, Drawable> symbols = new HashMap<String,
Drawable>();
        private String restClientURL;

        public UnitOverlay(Drawable defaultMarker, String restClientURL) {
                super(boundCenterBottom(defaultMarker));
                this.restClientURL = restClientURL;
                populate();
        }

        @Override
        public void draw(Canvas pCanvas, MapView pMapView, boolean pShadow)
{
                super.draw(pCanvas, pMapView, false);
        }

        public void clearOverlay(){
                mOverlays.clear();
                setLastFocusedIndex(-1);
                populate();
        }

        public void addOverlay(GeoPoint loc, ViewItem item) {
                setLastFocusedIndex(-1);
                OverlayItem oi = new OverlayItem(loc, item.getName(), "");
                if(symbols.containsKey(item.getImageURL())){
                        oi.setMarker(symbols.get(item.getImageURL()));
                }
                else{
                        Bitmap b = RestClient.getImage(restClientURL + 
"symbology?
type=milstd2525&" + item.getImageURL());
                        BitmapDrawable bd = new BitmapDrawable(b);
                        symbols.put(item.getImageURL(), bd.getCurrent());
                        if(b != null){
                                oi.setMarker(bd);
                        }
                        else{
                                Log.i("blah", "no image");
                        }
                }
            mOverlays.add(oi);
        }

        public void populateOverlay(){
                setLastFocusedIndex(-1);
                populate();
        }

        @Override
        protected OverlayItem createItem(int i) {
          return mOverlays.get(i);
        }

        @Override
        public int size() {
                return mOverlays.size();
        }

}

-- 

2. Problem finding a contact when ID is known

You don't need to create it.  It is column on the Contacts table. There is
also a conenience method on Contacts that will retrieve it for you.




Please tell me, though, how do you create a lookup key?  Can you give
or point me to a good example?

On Jan 31, 12:47 pm, Dmitri Plotnikov ()  <dplotni...@google.com>



 You



cr...@googlegroups.com>
groups.google.com/group/android-developers?hl=en

--

3. Using iptables in android

4. Best way to poll for XML?

5. How can I enable assert statement on Android?

6. Austin, TX Android Developer Lab ride share/hotel

7. Multi-threaded http requests cause exception