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

  • Home
  • SEARCH
  • 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 8508923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:17:37+00:00 2026-06-11T03:17:37+00:00

So I have this class that extends the Thread class. I use the thread

  • 0

So I have this class that extends the Thread class. I use the thread to connect my phone to a Bluetooth device and keep the connection on.

Once the connection is established (or once the user interacts with the GUI) I need to pass to another Activity.
I’d like to carry with me the thread just created so that I could interact with it (stop it, restart it, modify its status).

Should I make this thread implements Serializable (or Parcelable) and append it as a normal Extra to the Intent calling the other Activity?
Is it possible / correct / convenient ?

If the answer is not, I’d like to know why and which is the most correct method to implement such thing.

Thank you.

  • 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-11T03:17:38+00:00Added an answer on June 11, 2026 at 3:17 am

    Well, Thread is independent from Activity, regardless the fact it’s i.e. created there or its inner class (in if your Thread keeps reference to first activity, you are most likely leaking the memory there). If you want your thread fully independent from Activity, you should consider simply separating that functionality. One way is by extending Application and move all the code there. Then no matter what, as long as your application object exists, your thread could be easily reachable thru it. Other option is, as CommonsWare reminded, to just use regular Service and delegate this Bluetooth communication job to it. Whichever you choose, it will be much simpler and better than trying to pass Thread here and there.

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

Sidebar

Related Questions

I have this class called PollFrame that extends JFrame in a file called PollFrame.java
I have a MyCanvas class that extends JComponent. On this canvas I have drawn
I have this code that describes a service: public class navigation_web extends Service {
I have this controller in Code Igniter that begins with class MyController extends CI_Controller
I have a function B that has this declaration: public void B(Class<? extends C>
I have a db that is created like this... public class DataBaseManager extends SQLiteOpenHelper{
I have this class that contains vars for db connection; Imports Microsoft.VisualBasic Imports System.Data.SqlClient
I have a class that extends the Thread class and has its run method
I have a class that starts a few threads. Each thread (extends Thread) calls
I have a backgorund thread that extends AsyncTask and which I use in activity

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.