Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old March 8th, 2010, 07:12 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Mar 2010
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default saving Image

Hi

need a help urgent !!
I'm done with saving the image after capturing it
but I face another problem that the image is very small

and when i try to capatalize it , it become not clear

the code:
myImageButton02
.setOnClickListener(new OnClickListener() {

@Override
public
void onClick(View v)

{
// create camera intent

Intent intent =
new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

//Grant permission to the camera activity to write the photo.

intent.addFlags(Intent.
FLAG_GRANT_WRITE_URI_PERMISSION);
// start the camera intent and return the image

startActivityForResult(intent,1);
}
});


---------------------------------

@Override
protectedvoid onActivityResult(int requestCode, int
resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);

// if Activity was canceled, display a Toast message

if (resultCode == RESULT_CANCELED) {
Toast toast = Toast.makeText(
this,"camera cancelled", 10000);
toast.show();
return;
}

// lets check if we are really dealing with a picture

if (requestCode == 1 && resultCode == RESULT_OK)
{
String timestamp = Long.toString(System.currentTimeMillis());
// get the picture

Bitmap mPicture = (Bitmap) data.getExtras().get(
"data");
int width = mPicture.getWidth();
int height = mPicture.getHeight();
int newWidth = 500;
int newHeight = 80;
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
Matrix matrix =
new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
Bitmap resizedBitmap = Bitmap.createBitmap(mPicture, 0, 0, width,
height, matrix,
true);







// save image to gallery

MediaStore.Images.Media.insertImage(getContentResolver(), resizedBitmap, timestamp, timestamp);

}
}



thanks

Advertisements
Haya is offline  
Last edited by Haya; March 8th, 2010 at 03:04 PM.
Reply With Quote
sponsored links
Old February 4th, 2012, 11:22 PM   #2 (permalink)
New Member
 
Join Date: Feb 2012
Posts: 3
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Haya,, did you get the solution for this question,I am also facing same issue

Image quality decrease after saving to server
mayakannan is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:57 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.