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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:00:50+00:00 2026-05-22T23:00:50+00:00

I am using Eclipse to develop an Android application that plots Bluetooth data. I

  • 0

I am using Eclipse to develop an Android application that plots Bluetooth data.

I am using open source code, which has an existing solution that I want to extend and not replace to solve my development problem as stated above.

The open source code has a very nice and solid background thread that among other things continually logs BluetoothData to logcat even when I switch to a new activity.

Currently I have a solution which I am concerned about: I simply leverage a background thread method that writes to logcat to call a static plotData() method in my Plotting Activity. The result seems good. I get a nice plot. It clips along in real-time. Looks like an oscilloscope.

But I have received negative feedback about using the existing background thread coupled with a static method to plot the BluetoothDate. It has been suggested that I use a new thread, or add a handler, or use Async Task, or AIDL to solve my problem.

I have looked at all these solutions without success. Nothing seems to work like my static plotData() method. That is to say the existing background thread calls my static plotData() method which results in a real-time plot that looks great.

But I am still concerned about the negative feedback. I simply want to extend my existing background thread solution which I have done by having it call a static method to plot the data.

What are the problems I might face with this approach? Thread safety? Deadlock? I don’t know.

Why do people keep suggesting that I create a new thread, handler, Async Task, or Service to solve my problem when extending my existing thread to call a static method seems to work just fine?

Any suggestions? What are the problems with extending the existing thread to use a static method to plot the data in real-time?

  • 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-22T23:00:51+00:00Added an answer on May 22, 2026 at 11:00 pm

    Anyone who says that you should use AIDL for this is a loon who should not be listened to. 🙂 Also someone saying you need a Service if you don’t want to have your background thread running when the user is not viewing your activity.

    I’m not sure what you mean by “writes to logcat to call a static plotData().” You should write to logcat only for testing. Writing to logcat doesn’t cause a call to any Java method.

    If you are calling a static plotData() method on your Activity, you need to be extremely careful with this: first because it is difficult to figure out what activity instance should be called from there (it may go away at any time from the user finishing it, or be recreated as a new instance when the configuration changes, etc); and second because you can’t touch your app’s UI/view hierarchy from a background thread without risking that you corrupt its state (since the view hierarchy is single threaded).

    The general model one does for this kind of thing is to have a background thread doing some work, generating the next data to display. Once it is done with the work you send a message to the main thread to have it display the new data. AsyncTask can be a simple way to do this, it takes care of the underlying message sending and threading. You can also implement this yourself, at some point having a Handler that you post a Runnable on or send a Message to that once executed on the UI thread will update your view state.

    (Of course if you are using a SurfaceView, the whole point of that is to allow drawing to it outside of the main UI loop, so your background thread could just draw directly on to it as needed. Basically that is like writing a game.)

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

Sidebar

Related Questions

I develop an Android application using Eclipse and the Android emulator. Sometimes I don't
Using Eclipse I want to view the source code for a core Java class
I'm using Eclipse to learn to develop Android applications in Java. I haven't used
I recently started using eclipse and an AVD emulator to develop android apps for
I am using Eclipse to develop both C and Java. I have an Android
I'm trying to develop a widget for Android. I'm using Eclipse but I can't
I'm trying to develop an android application that uses network connection. The server is
I develop an Android App using eclipse, the Android Development Tools (ADT) plugin and
I'm using Eclipse-plugin to develop Android applications on mac. I've got a project and
I'm using Eclipse to develop applications for android, and I want to integrate Admob

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.