I have an android app in which I take a photo using the android camera then I view the photo, if I like it then I upload the picture to a website.
Uploading the picture to the website I’ve noticed that there are a few pixels that are not visible on the phone!!!On the website the picture has a few extra-details that are not visible on the phone screen!!!
The picture on the phone screen is set in an imageview.
This is the layout of the activity:
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:id="@+id/myPic"
/>
<Button
android:text="Confirm Photo"
android:layout_toLeftOf="@id/back"
android:id="@+id/confirm"
android:layout_marginTop="530dip"
android:layout_height="wrap_content"
android:layout_width="165dip"
android:layout_alignParentRight="true"
>
</Button>
</RelativeLayout>
This is how I set the picture to the imageview:
Bundle extras = getIntent().getExtras();
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize =2;
byte[] imageData = extras.getByteArray("imageData");
Bitmap myImage = BitmapFactory.decodeByteArray(imageData , 0, imageData.length,options);
Matrix mat=new Matrix();
mat.postRotate(90);
bitmapResult = Bitmap.createBitmap(myImage, 0, 0, myImage.getWidth(),myImage.getHeight(), mat, true);
Canvas c = new Canvas(bitmapResult);
drawTextImage(bitmapResult);
StoreByteImage(this, bitmapResult,100);
ImageView imageView = (ImageView) findViewById(R.id.myPic);
imageView.setImageBitmap(bitmapResult);
For extra code or other details I’m here to give it to you.Thanks
If you’re talking about the image on the website being larger than the one on your phone, then it’s because your scale type is set to:
and your imageview bound probably doesn’t match the image (thus the image is cropped). Try adding this line to the imageview and see if it makes a difference.
Lastly change you layout height and width attributes to: