Create NinePatch at Runtime

Posted by Pedro Lopes on Stack Overflow See other posts from Stack Overflow or by Pedro Lopes
Published on 2010-12-28T15:49:40Z Indexed on 2010/12/28 15:54 UTC
Read the original article Hit count: 313

Hello everybody!

I have a business need to create the NinePatchDrawable objects at runtime, this is, an exterior .png image is received from a server and it has to be applied in a button's background (for example) as a nine patch.

I have tried to create the NinePatchDrawable object, but the constructor asks me for a "byte[] chuck" that describes the patch. The thing is, I have no idea on how to build this chunck from a bitmap that does not have the 9patch information in it.

Any ideas on this topic? Am I seeing the problem from a wrong perpective?

Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about android