Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Help needed regarding Bitmaps and Canvas objects

Okay, so my objective is as follows:

I need to create a 200x200px PNG filled with one solid color (I have the hex for the color) and get the URI for this image so I can pass it to an Intent for being shared to any service supporting images.

How do I got about this?

3 Answers

Nicolas Hampton
Nicolas Hampton
44,725 Points

Are you looking for the program to create the image or the transfer the image, or both? Where is the image located, on the web or on the android device?

Nicolas Hampton
Nicolas Hampton
44,725 Points

I found this library for the creation of png files, let me look at it really quick:

https://code.google.com/p/pngj/

Nicolas Hampton There is no image. I was to create it using the Paint class or something on a Canvas object

Nicolas Hampton
Nicolas Hampton
44,725 Points

https://code.google.com/p/pngj/wiki/Overview

The second example on this wiki for pngj explains how to create a solid color file using this library. It's small and fast it looks like. Might be the piece you're looking for.

Nope, not really, mate.