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. What happens if...

...you take a non-activated, devoid-of-SIM G1 and put a month-to-month
voice SIM in it? Can you boot up and run apps?

And if so, what happens when the SIM's month runs out?

--

2. android emulator speed

i was disappointed that the boot speed of the android emulator was
more slower than my peer.
of course, the spec was identical, his os was Win7 but my os was
XPSP2.

how can it be possible?
is there any one who knows the way boosts the speed of android
emulator?

3. Start new activity in TAB

4. MediaPlayer ... a nest of undocumented pitfalls

5. Looking for some reading on the Android Framework

6. No route to host issue, but Browser application works fine

7. How Can I Debug Android native code