Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8836461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:30:00+00:00 2026-06-14T09:30:00+00:00

If I set TextView bytes like the following: byte[] byteArray = { 25, 20,

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:30:01+00:00Added an answer on June 14, 2026 at 9:30 am

    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:

    // remove signed bit(32nd), keep value as "next" (127+...) positive byte value
    int unsignedValue = 255 - ((int)byteArray[i])&0b1111111;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to set my textview to have a string, then, after some seconds
I have a TextView which i set the text using setText(). In properties, I
I would like to programmatically set maxLength property of TextView as I don't want
I want to set a TextView as the value of an integer, hopefully like
I am trying to set the textview within a pop up and the string
How to i i set the TextView and ProgressBar to their findViewById views from
after I set the TextView backgroundColor to whatever I want. Fri2030 = (TextView) findViewById(R.id.tvFri2030);
I'm new to Android and I have the following problem: I wanted to set
i want to set textview text in alertbox. I want to make the countdown
I have an empty TextView set for my ListView . When there is no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.