NinePatchDrawable constructor

by Rmac » Tue, 03 Mar 2009 09:38:03 GMT


Sponsored Links
 I am trying to create a NinePatchDrawable programmatically, but there
is no documentation on the constructor's argruments (Bitmap bitmap,
byte[] chunk, Rect padding, String srcName).  Does anyone know what
chunk and padding are... and how to specify them?

Thanks.
--~--~---------~--~----~------------~-------~--~----~



NinePatchDrawable constructor

by Dianne Hackborn » Tue, 03 Mar 2009 10:12:07 GMT


 This isn't really intended to be used much by apps.  The byte[] is the raw
data of the PNG 9-patch extension chunk that we defined for android, which
aapt generates; you'll have to build that all yourself, and look at the
ResourceTypes.h header file for a description of its contents.  The padding
is just the padding around the image, which is returned by the Drawable.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


NinePatchDrawable constructor

by Romain Guy » Tue, 03 Mar 2009 10:14:18 GMT


 The nine patch chunk can be returned by the Bitmap class. Load a
Bitmap with BitmapFactory, then call getNinePatchChunk() to get the
chunks. The padding is a bit more complicated. You need to first
create a Rect and pass that Rect to the approprite
BitmapFactor.decode*() method. While decoding the 9patch,
BitmapFactory will fill that Rect with the padding as encoded in the
9patch.







-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~



NinePatchDrawable constructor

by Ron » Sun, 08 Mar 2009 02:06:58 GMT


 Does this work?  I took a 9patch png that works fine if I use it via
setBackgroundResource(), but instead loaded the png bytes and decoded
them via BitmapFactory to get a Bitmap and used the getNinePatchChunk
() method in an attempt to create a NinePatch object from the bitmap.
Everything runs ok until the constructor for NinePatch(bitmap, chunk,
src) causes the app to crash... no stacktrace, but a ton of internal
debug diagnostics are sent to logcat... none of which makes any sense
to me nor points to the problem.






--~--~---------~--~----~------------~-------~--~----~



NinePatchDrawable constructor

by Romain Guy » Sun, 08 Mar 2009 03:39:22 GMT


 > Everything runs ok until the constructor for NinePatch(bitmap, chunk,

It necessarily does. And without seeing the logs...







-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~



NinePatchDrawable constructor

by Ron » Tue, 10 Mar 2009 01:37:08 GMT


 orry, the last time I posted I couldn't figure out how to get the
logcat text... then I found it was relatively simple. Here is the
dump:

03-09 12:29:05.734: INFO/DEBUG(28): *** *** *** *** *** *** *** ***
*** *** *** *** *** *** *** ***
03-09 12:29:05.734: INFO/DEBUG(28): Build fingerprint: 'android-
devphone1/dream_devphone/dream/trout:1.0/UNLOCKED/116222:userdebug/
test-keys'
03-09 12:29:05.734: INFO/DEBUG(28): pid: 8966, tid: 8966 >>>
mobiliti.android.ui <<<
03-09 12:29:05.734: INFO/DEBUG(28): signal 11 (SIGSEGV), fault addr
00000008
03-09 12:29:05.734: INFO/DEBUG(28): r0 0000baf0 r1 00000007 r2
ad03e18d r3 00000000
03-09 12:29:05.734: INFO/DEBUG(28): r4 0000baf0 r5 00000000 r6
ad33f411 r7 4104d880
03-09 12:29:05.744: INFO/DEBUG(28): r8 bef5c630 r9 4104d878 10
4104d868 fp 00000000
03-09 12:29:05.744: INFO/DEBUG(28): ip ad33f411 sp bef5c610 lr
ad0471bd pc ad03e1a0 cpsr 00000030
03-09 12:29:06.194: INFO/DEBUG(28): #00 pc ad03e1a0 /system/
lib/libdvm.so
03-09 12:29:06.214: INFO/DEBUG(28): #01 pc ad33f426 /system/
lib/libandroid_runtime.so
03-09 12:29:06.224: INFO/DEBUG(28): #02 pc ad00d9f4 /system/
lib/libdvm.so
03-09 12:29:06.224: INFO/DEBUG(28): #03 pc ad04120e /system/
lib/libdvm.so
03-09 12:29:06.234: INFO/DEBUG(28): #04 pc ad012748 /system/
lib/libdvm.so
03-09 12:29:06.234: INFO/DEBUG(28): #05 pc ad02a92c /system/
lib/libdvm.so
03-09 12:29:06.234: INFO/DEBUG(28): #06 pc ad0169d0 /system/
lib/libdvm.so
03-09 12:29:06.244: INFO/DEBUG(28): #07 pc ad052096 /system/
lib/libdvm.so
03-09 12:29:06.244: INFO/DEBUG(28): #08 pc ad03ccbc /system/
lib/libdvm.so
03-09 12:29:06.254: INFO/DEBUG(28): #09 pc ad012748 /system/
lib/libdvm.so
03-09 12:29:06.254: INFO/DEBUG(28): #10 pc ad02a92c /system/
lib/libdvm.so
03-09 12:29:06.254: INFO/DEBUG(28): #11 pc ad0169d0 /system/
lib/libdvm.so
03-09 12:29:06.264: INFO/DEBUG(28): #12 pc ad051f10 /system/
lib/libdvm.so
03-09 12:29:06.264: INFO/DEBUG(28): #13 pc ad03f87a /system/
lib/libdvm.so
03-09 12:29:06.274: INFO/DEBUG(28): #14 pc ad3282b4 /system/
lib/libandroid_runtime.so
03-09 12:29:06.274: INFO/DEBUG(28): #15 pc ad328d40 /system/
lib/libandroid_runtime.so
03-09 12:29:06.274: INFO/DEBUG(28): #16 pc 00008c12 /system/
bin/app_process
03-09 12:29:06.284: INFO/DEBUG(28): #17 pc afe1dbd2 /system/
lib/libc.so
03-09 12:29:06.294: INFO/DEBUG(28): #18 pc afe0b010 /system/
lib/libc.so
03-09 12:29:06.304: INFO/DEBUG(28): #19 pc b0000d70 /system/
bin/linker
03-09 12:29:06.304: INFO/DEBUG(28): stack:
03-09 12:29:06.304: INFO/DEBUG(28): bef5c5d0 0000a000 [heap]
03-09 12:29:06.304: INFO/DEBUG(28): bef5c5d4 ad0481ab /system/
lib/libdvm.so
03-09 12:29:06.314: INFO/DEBUG(28): bef5c5d8 00000322
03-09 12:29:06.314: INFO/DEBUG(28): bef5c5dc 00000000
03-09 12:29:06.314: INFO/DEBUG(28): bef5c5e0 400240b8
03-09 12:29:06.314: INFO/DEBUG(28): bef5c5e4 ad060361 /system/
lib/libdvm.so
03-09 12:29:06.314: INFO/DEBUG(28): bef5c5e8 4476be28
03-09 12:29:06.314: INFO/DEBUG(28): bef5c5ec 00000003
03-09 12:29:06.314: INFO/DEBUG(28): bef5c5f0 0000baf0 [heap]
03-09 12:29:06.324: INFO/DEBUG(28): bef5c5f4 00000001
03-09 12:29:06.324: INFO/DEBUG(28): bef5c5



NinePatchDrawable constructor

by Romain Guy (Google) » Thu, 12 Mar 2009 09:18:45 GMT


  can't help you with native crashes unfortunately :(

On Mar 9, 10:36am, Ron <ry...@mac.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Android : How to do prioterization of data flow through one network interface over others

Hi,
I am using Cupcake version of Android. In my system I have two network
interfaces to send the data traffic - one network Interface on radio
path and second network interface on Wifi path. Both the interfaces
are up simultaneously.

So 'ifconfig' command in Linux shell (when connect the Android Dev
phone using ADB) shows both the interfaces up and routing table also
have entries for both the interfaces.

Query: How do I prioterize data flow through one interface (say wifi
interface) than other? Is there any API is available at application
level for this? OR some feature of Linux 2.6 kernel that I need to
use?

Regards,
debashis

--~--~---------~--~----~------------~-------~--~----~

2. How to Add menu of my app to gallery and other applications

Hi!
My application is working on images. I want to a add my menu in
Gallery application and other image handeling applications.
There are many posts regarding this but still I could not succesfully
achive that.

I could not find any sample code for full application.

It will be great if any one can pls share a working sample code for
full class and full manifest file.

Thanks
Naveen

--~--~---------~--~----~------------~-------~--~----~

3. How to add the character '&' intto the <String></String>tag?

4. Beginner Android-Java development:

5. How can I implement an ImageView with arbitrary shape?

6. Periodically updating GUI

7. Enabling bluetooth on Android