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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:59:52+00:00 2026-05-16T07:59:52+00:00

I have a Network Client class that is receiving a large binary block and

  • 0

I have a Network Client class that is receiving a large binary block and parsing it into a usable Java object. The Network Client is on a separate thread from the app’s View. What is the best way to make this object available to the View? I’ve come up with the following solutions, but I feel like none of them are the correct one:

  1. Create the object in the Network Client and let the View access it directly
    • I would send a small message in a Handler telling the View that the data has been updated
    • Con: requires that I synchronize the object between the threads to ensure that the Network Client doesn’t replace the object while the View is accessing it
  2. Serialize (Parcel?) the object in the Network Client and send it through a Handler to the View
    • Pro: there are no questions of ownership of the data
    • Con: would probably be a huge performance drain on the app
  3. Create a reference to the object and pass that to the View
    • I come from a C++ background, and I’m not sure if this is even possible in Java. I C++, I could just send the View a pointer to the object and let it take care of it. That seems like something Java wouldn’t let me do. Is this feasible?

Are any of these solutions advisable, or should I approach the problem in a completely different way?

  • 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-16T07:59:52+00:00Added an answer on May 16, 2026 at 7:59 am

    If you don’t want to keep downloading when the activity is in the background, then use non-blocking IO, not threads.

    If you do want to keep downloading when the activity is in the background, you probably want to use a service. You can make the object Parcelable or so; I think the underlying service implementation passes pointers around if your activity and service are within the same process (I think they are by default, but ICBW).

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

Sidebar

Ask A Question

Stats

  • Questions 515k
  • Answers 515k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You have a couple of options here: Use a class… May 16, 2026 at 6:37 pm
  • Editorial Team
    Editorial Team added an answer Yes. Add an onclick to the TR and then have… May 16, 2026 at 6:37 pm
  • Editorial Team
    Editorial Team added an answer The problem is that in a new thread, HttpContext.Current (and… May 16, 2026 at 6:37 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a network client with a request method that takes a std::streambuf* .
I have a worker thread in a class that is owned by a ChildView.
I have client which has a problem with printing from JAVA applications, using old
I have a distributed application that uses .NET Remoting on an in-house gigabit network.
Currently I have an application that receives an uploaded file from my web application.
I have a set of 'dynamic data' that I need to bind to the
I have a very simple server/client performance test using boost::asio on Windows and it
I have to write a multiplayer pacman game in Java for a university assignment
I want to create a server and client that sends and receives UDP packets
I have a list of IP's in IPv4 format that i have collected from

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.