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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:13:20+00:00 2026-06-16T05:13:20+00:00

I am working on Android application that has several threads – one of them

  • 0

I am working on Android application that has several threads – one of them is getting data from GPS receiver 1 time per second. I would like other threads to have access to information from the GPS thread.

I already tried doing it with message queues, but it made the code quite messy – all new threads I created had to handle messages in it’s own way, so I had to do a lot of new implementation in every thread class.

I would like to be able to simply get the data in this manner:

ApplicationState.getLocation();

so I can use the most recent data. How can I accomplish it? I don’t want to create static class with synchronized fields because I don’t want to lock the threads for too long because I am doing some online image analysis in other thread.

What approach would be the best here?

Cheers,
Nebril

  • 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-16T05:13:22+00:00Added an answer on June 16, 2026 at 5:13 am

    Have you considered using an Event Bus system? Otto, an Apache licensed library from Square is pretty neat.

    You could create a location updating class that fires new LocationUpdateEvents. Any objects interested in receiving this update can have a method annotated with @Subscribe. It’s sweet method for interprocess communication that doesn’t rely on messy listener interfaces.

    Another advantage of Otto is that your LocationUpdater class could have a method annotated with @Produce. With this, any object that begins listening for LocationUpdateEvents will receive one immediately with the last location found by your LocationUpdater.

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

Sidebar

Related Questions

I'm working on an Android application that has several Activities. In it I have
i am working to make a Android application that can upload and download data
We're designing an Android app that has several activities which are working in a
I'm working on an Android application that has 4 activities : A -> B
I'm working on an android application that needs to obtain a random picture from
I'm working on an Android application. I have an activity that has this method:
Greetings! I'm working on an application that has a BroadcastReceiver listening on android.intent.action.PHONE_STATE, which
I am working on an Android Honeycomb (v3.0) application that has a requirement of
I’m working on an android application that currently has two Activities, A and B,
I'm working on an Android app that has to store data in a database.

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.