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. Update information in contacts

Hi,

I am trying to update information in Contacts database, phonenumber.

Analyzing following code:

        public ArrayList<Phone> getPhoneNumbers(String id) {
                ArrayList<Phone> phones = new ArrayList<Phone>();

                Cursor pCur = this.cr.query(
                                
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                                null,
                                
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?",
                                new String[]{id}, null);
                while (pCur.moveToNext()) {
                        phones.add(new Phone(
 
pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))
                                        ,
pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE))
                        ));

                }
                pCur.close();
                return(phones);
        }



I am trying to update info about record with id=1:

Doc says that I could use getContentResolver.update();

So I want to use it like

ContentResolver cr = getContentResolver();
final ContentValues values = new ContentValues();
values.put(ContactsContract.CommonDataKinds.Phone.NUMBER, "55555555");

cr.update(ContactsContract.Contacts.CONTENT_URI, values, where,
selectionArgs);

Will this work and how to configure where and selectionArgs properly
for doing this if it works?

--

2. Cara Memperbesar Internal Storage / Resize NAND Partitions

Suhu Ocu saia ada problem ni, bersangkutan dengan merisize nand
partition...

kondisi HH dah di S-OFF, di makeup dengan ROM miui rodriguez 11.12

mwnya bikin partisi pake hboot patch n1table. patchnya udah didonlod,
sdk udah di donlod + di-extract, di C:\Android\android-sdk-windows.
udah pake XP sp3 juga

langkah 1 sampe 5 udah lancar, tapi begitu masuk ke step 6 jadi
bingung... masuk command prompt trus ketik seperti yg di tulis tp ga
terjadi apa2 di HH... cma ada pesan error ga mengenali command itu...

yang saia bingung dimana salahnya y? apa konfigurasi sdk nya? pokoknya
command nya ga bisa di jalanin

-- 
===============
"

3. Can I get a web link to my newly published app

4. Htc sync

5. [WTA] [OOT] HELP!! rooting spica gagal terus..

6. [WTS] Case/Screen Guard/Dock Charger+Sync Samsung Galaxy S dan Galaxy Tab

7. Market Licensing Test account not working intermittently?