If I set TextView bytes like the following:
byte[] byteArray = { 25, 20, -101 };
TextView encrypted_text = (TextView) findViewById(R.id.encrypted);
encrypted_text.setText(new String(byteArray));
then I can retrieve back 25, 20, but not -101 value.
For the 3rd character I always get -3 as output:
Log.v(TAG, "3rd byte: "+ (byte) encrypted_text.getText().toString().charAt(2));
P.S. Actually -3 is returned for all not visible characters.
How can I get my byteArray back from TextView?
I got an idea how to store and retrieve back negative byte values to and from TextView.
First, we need to translate signed byte into unsigned one. Because in Java all type are signed we need to do it manually: