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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:40:14+00:00 2026-05-31T15:40:14+00:00

I have modified the Android Bluetooth Chat code so that bytes received from the

  • 0

I have modified the Android Bluetooth Chat code so that bytes received from the BluetoothChatService will be sent directly to the BluetoothChat Activity.

The sending rate of the other Bluetooth device is 125Khz, each packet is 20bytes.
So there will be around 125*20 bytes per second which has to be received by the Service and then sent to the Activity.

However, I found out that there will be packet loss in the data received by the Activity. I have verified that the data received in the Service is indeed correct.

This is the part of code which sends a 20 byte object to the Activity.

mHandler.obtainMessage(BluetoothChat.MESSAGE_READ, 20, -1, buffer)
                        .sendToTarget();

This is the handler that gets message back from The BluetoothChatService

private final Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
           case MESSAGE_READ:
                byte[] readBuf = (byte[]) msg.obj;
    ...}
}

Any idea how to solve this problem? Thanks.

  • 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-31T15:40:15+00:00Added an answer on May 31, 2026 at 3:40 pm

    This is the part of code which sends a 20 byte object to the Activity.

    It is sending a reference to your buffer. If you reuse that buffer when reading in more Bluetooth data, your old data may be overwritten before the activity has had a chance to use the data.

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

Sidebar

Related Questions

I have used BluetoothChatService class from BluetoothChat example program for bluetooth connection. I have
i download AlarmClock in the sound code of android,i have modified it,but i want
I've modified the bluetooth chat example from the SDK demos to be able to
I have an android project that has a test module that will remove and
I have modified a working Windows service that had always been starting beforehand. After
I have a dataset that I have modified into an xml document and then
I have an BroadcastReceiver for handling new or modified applications: <receiver android:name=.PackageHandler > <intent-filter>
I'm starting with Android development, and I'm trying to do an application that will
I have already asked about this for android, but I will broaden the question
Background: I have an ImageView that I've modified to be scrollable (drag) and zoom-able

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.