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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:23:49+00:00 2026-05-20T20:23:49+00:00

Hey all, this will contain a few questions since I don’t seem to really

  • 0

Hey all, this will contain a few questions since I don’t seem to really get it.

I have 1 class, the activity. which should display informations.

Then I have a background thread, extends runnable, which keeps getting new data (there for I didn’t use AsyncTask, I could use it as a service, but since I hold a some critical resources in it, I would like not have it released when exiting the activity thread)

But I am in great doubt how to communicate between these 2.
First I thought of Intent, but these seem to be used mostly for launching other activities, or alike, and I need something permanent, since data will be in a steady flow.
Then I found out handler, but this doesn’t seem to work when my thread is not an innerclass, so I’m thinking about either going back to the old Java observer pattern, if it’s not possible to somehow pass the handler to the outerclass.

Any thoughts would be greatly appreciated

Sincerely
Anders Metnik

  • 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-20T20:23:50+00:00Added an answer on May 20, 2026 at 8:23 pm

    There is a mechanism for your case – it is called handlers. Read more here.

    As for having thread as inner class:
    Create your thread as a separate class, add a constructor with a handler parameter and pass it from your activity.

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

Sidebar

Related Questions

Hey all, i have been trying for a few minutes on this problem and
Hey all! This bit of code always returns 0, even though errcheck will have
Hey all, this is the code i have to check for a day thats
Hey all, I'm about to rip my hair out. I have this client that
NOTICE: THIS IS SOLVED, I WILL PUBLISH THE SOLUTION HERE ASAP. Hey all, Ok...
Hey All, I have an upcoming project that will require the same assets (images,
Hey all. I'm scripting a blogging system for my website. So I have this
Hey all. I'm scripting a blogging system for my website. So I have this
hey all when installing my app to the emulator I get this: ERROR/AndroidRuntime(465): java.lang.RuntimeException:
Hey all, I don't know how to properly phrase this but when I run

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.