displaypicture.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent();
//startActivityForResult(i, PICK_IMAGE_REQUEST_CODE);
startActivityForResult(new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI),
GET_FROM_GALLERY);
}});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent
data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==GET_FROM_GALLERY && resultCode == Activity.RESULT_OK) {
Bitmap bitmap = null;
Uri contentUri = data.getData();
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(contentUri, proj, null, null, null);
int column_index =
cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String tmppath = cursor.getString(column_index);
float res = this.rotationForImage(this.getApplicationContext(),
contentUri);
Intent intent= new Intent(this,NasalProjectionActivity.class);
intent.putExtra("imagePath",tmppath);
intent.putExtra("resource ", res);
startActivity(intent);
On the receiving side:
Bitmap b = BitmapFactory.decodeFile(getIntent().getStringExtra("imagePath"
));
DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager wm = (WindowManager)
getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
wm.getDefaultDisplay().getMetrics(displayMetrics);
int screenWidth = displayMetrics.widthPixels;
int screenHeight = displayMetrics.heightPixels;
Bitmap scaled = Bitmap.createBitmap(b, 0, 0, b.getWidth(), b.getHeight(),
matrix, true);
On Sun, May 6, 2012 at 4:00 PM, Jason Teagle <[email protected]> wrote:
> This is the code im using to rotate an image,
>>
>
> All that code does is determine the angle in degrees to rotate by - it
> doesn't actually try and rotate an image. Show us the code where you
> actually load / set the image into an object, and then how you attempt to
> apply the rotation angle you obtained from the code you just posted for us.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to
> android-developers@**googlegroups.com<[email protected]>
> To unsubscribe from this group, send email to
> android-developers+**[email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/**group/android-developers?hl=en<http://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