I want the selected picture that is passed to the new activity to fit the screen size. I want to resize the bitmap to fit the screen exactly. Thanks
On Mon, Apr 30, 2012 at 11:10 PM, Justin Anderson <[email protected]>wrote: > What exactly are you trying to accomplish? You said "the returned image > is stretched and doesn't fit the mobile screen size" but I don't see > anywhere in your code where you are doing anything with the screen size of > the device... What exactly are you expecting and what exactly are you > seeing? > > > Thanks, > Justin Anderson > MagouyaWare Developer > http://sites.google.com/site/magouyaware > > > On Mon, Apr 30, 2012 at 1:04 PM, Mohamed ElSanousi > <[email protected]>wrote: > >> No. >> >> >> On Mon, Apr 30, 2012 at 10:53 PM, Justin Anderson >> <[email protected]>wrote: >> >>> Are you putting the Bitmap in an ImageView? >>> >>> Thanks, >>> Justin Anderson >>> MagouyaWare Developer >>> http://sites.google.com/site/magouyaware >>> >>> >>> On Mon, Apr 30, 2012 at 12:44 PM, Mohamed ElSanousi < >>> [email protected]> wrote: >>> >>>> >>>> >>>> Code: >>>> I have this code in the Activity result, when the user hits load, it >>>> will open the gallery allow him to choose a picture. The selected pictured >>>> is passed to another activity, here is where i'm facing the problem. The >>>> picture doesn't fit the screen. >>>> >>>> >>>> Uri selectedimage= data.getData(); >>>> >>>> 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); >>>> >>>> >>>> >>>> Intent intent= new Intent(this,NasalProjectionActivity.class); >>>> >>>> intent.putExtra("imagePath",tmppath); >>>> >>>> startActivity(intent); >>>> >>>> >>>> Receiving Activity, >>>> >>>> Thats what i have on the receiving activity. >>>> >>>> >>>> >>>> Bitmap b = BitmapFactory.decodeFile(getIntent().getStringExtra( >>>> "imagePath")); >>>> >>>> int newHe=750; >>>> >>>> int newWe=750; >>>> >>>> >>>> >>>> >>>> int width=b.getWidth(); >>>> >>>> int height = b.getHeight(); >>>> >>>> float scaleWidth = ((float) newWe) / width; >>>> >>>> float scaleHeight = ((float) newHe) / height; >>>> >>>> Matrix matrix = new Matrix(); >>>> >>>> matrix.postScale(scaleWidth, scaleHeight); >>>> >>>> Bitmap resizedBitmap = Bitmap.createBitmap(b, 0, 0, width, >>>> height, matrix, false); >>>> >>>> Thanks alot >>>> >>>> On Mon, Apr 30, 2012 at 7:51 PM, Justin Anderson <[email protected] >>>> > wrote: >>>> >>>>> What have you tried so far? How are you loading the image? >>>>> >>>>> Thanks, >>>>> Justin Anderson >>>>> MagouyaWare Developer >>>>> http://sites.google.com/site/magouyaware >>>>> >>>>> >>>>> >>>>> On Mon, Apr 30, 2012 at 1:55 AM, Mohamed ElSanousi < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi!! >>>>>> >>>>>> I'm trying to load a picture from the gallery and display, everything >>>>>> works fine except that the returned image is stretched and doesn't fit >>>>>> the mobile screen size? I need help, thanks alot :) >>>>>> >>>>>> -- >>>>>> 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 >>>>> >>>>> >>>>> -- >>>>> 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 >>>>> >>>> >>>> -- >>>> 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 >>>> >>> >>> -- >>> 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 >>> >> >> -- >> 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 >> > > -- > 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 > -- 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

