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 4553760
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:59:32+00:00 2026-05-21T16:59:32+00:00

I am working on an Android app in Java which writes data I receive

  • 0

I am working on an Android app in Java which writes data I receive via bluetooth to an arrayadapter to be displayed on the screen. Some of the data includes new lines and carriage returns and instead of those executing their respective operations in the arrayadapter, I instead just want to just display their literal ASCII value (\n, \r) in the arrayadapter.
Is there a natural way to do this within the Android SDK or do I need to parse the data in order to do this?
Here is the bit of code I use to set the arrayadapter:

byte[] writeBuf = (byte[]) msg.obj;
String writeMessage = new String(writeBuf);
conversationArrayAdapter.add("Me:  " + writeMessage);

Thanks for any input!

  • 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-05-21T16:59:32+00:00Added an answer on May 21, 2026 at 4:59 pm

    You will have to escape them inside the string so they display as “\n” and “\r”, otherwise the view will iterpret the character itself; something like:

    String writeMessage = new String(writeBuf);
    String escaped = writeMessage.replaceAll("\n","\\n").replaceAll("\r","\\r");
    

    Not 100% sure of that syntax, but that’s the idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an Android app which has an activity and a widget. This
So I'm writing an Android app which uses a large c++ library. I have
I'm working on my first android app and have an SQLite database set up
So I'm writing an android app, and I have an xml parser class that
I m working on a word scramble game which allows user to move the
So I ran into a problem today while working on my Android program. I
I'm retrieving a datetime from a SQLite DB which comes out in the format...
Why is it so hard to find an Android example of sending email using
Basically I have created a Blackjack app that uses several methods that get called
Okey, I've done all the business, followed all the steps, but still can't get

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.