aspose file tools*
The moose likes Android and the fly likes Creating a new Bitmap in xml by cropping an existing image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Creating a new Bitmap in xml by cropping an existing image" Watch "Creating a new Bitmap in xml by cropping an existing image" New topic
Author

Creating a new Bitmap in xml by cropping an existing image

Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Hi,

In Android ApiDemos, there are examples of creating new images from existing images in xml.
For example,


Is it possible to create a new image by cropping an existing image?

- Sonny


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Imran Mohd
Ranch Hand

Joined: Mar 02, 2009
Posts: 38
1. convert the image in to Bitmap

2. Than the Crop the obtained 'bitmap'


Cheers,
Mohd Imran (SCJP 1.5)
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Thanks, Imran.
But, what I am trying to find out is whether there is a way of doing that when defining a resource in the xml file in res/drawable.
Then I can use the cropped image in a layout xml.
pavanr ramadugula
Greenhorn

Joined: Nov 13, 2011
Posts: 1
No. You can't define a cropped image in the static xml. If you have the cropped image available, you can use it similar to any other image. To get this done at runtime, using Bitmap is the way. Hope it helps.
 
jQuery in Action, 2nd edition
 
subject: Creating a new Bitmap in xml by cropping an existing image