Oh ok. And how will I get the actual pixel dimensions of the screen? I
really need your help
 Thanks

On Tue, May 1, 2012 at 12:16 AM, Justin Anderson <magouyaw...@gmail.com>wrote:

> 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.
>>
> Well, then you would need some code to get the actual pixel dimensions of
> the screen... right now you have hardcoded values of 750.  Keep in mind
> that doing this will cause distortion of the image... It will look
> stretched either in width or height.
>
>
> Thanks,
> Justin Anderson
> MagouyaWare Developer
> http://sites.google.com/site/magouyaware
>
>
> On Mon, Apr 30, 2012 at 1:56 PM, Mohamed ElSanousi 
> <mmurtad...@gmail.com>wrote:
>
>>
>>  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 
>> <magouyaw...@gmail.com>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 <mmurtad...@gmail.com
>>> > wrote:
>>>
>>>> No.
>>>>
>>>>
>>>> On Mon, Apr 30, 2012 at 10:53 PM, Justin Anderson <
>>>> magouyaw...@gmail.com> 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 <
>>>>> mmurtad...@gmail.com> 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 <
>>>>>> magouyaw...@gmail.com> 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 <
>>>>>>> mmurtad...@gmail.com> 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
>>>>>>>> android-developers@googlegroups.com
>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>> android-developers+unsubscr...@googlegroups.com
>>>>>>>> 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
>>>>>>> android-developers@googlegroups.com
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> android-developers+unsubscr...@googlegroups.com
>>>>>>> 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
>>>>>> android-developers@googlegroups.com
>>>>>> To unsubscribe from this group, send email to
>>>>>> android-developers+unsubscr...@googlegroups.com
>>>>>> 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
>>>>> android-developers@googlegroups.com
>>>>> To unsubscribe from this group, send email to
>>>>> android-developers+unsubscr...@googlegroups.com
>>>>> 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
>>>> android-developers@googlegroups.com
>>>> To unsubscribe from this group, send email to
>>>> android-developers+unsubscr...@googlegroups.com
>>>> 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 android-developers@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscr...@googlegroups.com
>>> 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 android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> 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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to