Android Question How to understand working with Bytes ?

Herbert32

Active Member
Licensed User
Longtime User
Hi,

since a few days i'm dispairing on working with datatype 'Byte'...

All my research brings me to the ByteConverter-Library. But i have to say that i don't understand how to use it :-(

Actually i try to write some bytes to a nfc-tag which works great by using some samples from this forum... but to come further, it seems that i have to understand the usage of the Byte-datatype...

for example:
B4X:
    TagTech.RunAsync("TT", "transceive", Array(Array As Byte(0xA2, 0xD3, 0x00, 0x00, 0x00, 0x00)), 0)

It's not hard to understand that ' Array As Byte(0xA2, 0xD3, 0x00, 0x00, 0x00, 0x00) ' builds an Array which contains 6 Bytes - But how can i change the value of an array-item ???

What do i have to do to change the second Byte in this array from 0xD3 to 0xFF by code?

hopefully someone can show me some links which will help me to understand working with Bytes :-/

thx in advance
Herbert
 

Herbert32

Active Member
Licensed User
Longtime User
Thank you for your reply.

I understand so far. - My problem seems to be there where i have to generate the '0xFF'

I can genereate a string which contains 'FF' or also a int with value 255 which should be '0xFF' but i don't understand how to generate the byte-variable which contains '0xFF' maybe by converting from a string or int :-(
 
Upvote 0

Herbert32

Active Member
Licensed User
Longtime User
finally i need a way to convert a string which contais the value "FF" to its Byte-equivalent - usually this should not be so complicated but i really can't find the tree by searching in this great forrest :-(
 
Upvote 0
Top