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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:08:03+00:00 2026-05-25T15:08:03+00:00

I m writing an app containing an asyncTask which continuously (every seconds or so)

  • 0

I m writing an app containing an asyncTask which continuously (every seconds or so) adds a value to an ArrayList<Float> (declared static).

The value is a measure in inches that I want to plot.
In order to do that I have implemented a solution with OpenGL ES.
And every time I add a new value my AsynTask calls the requestRender() method.
Then the drawRenderer() take the ArrayList<Float> and draw lines with it.

At this point everything works perfectly fine.

I also want that the user can pinch-zoom and move the plot. So I have a TouchsurfaceView which also calls requestRender() when needed.
Most of the time it works, but time to time I get an error because of concurrent requests for the ArrayList<Float> (almost sure of that).

Any ideas How can I solve this ? I see lock and synchronized stuff, but can t find how to properly use them for my case.

Thanks for reading me.

  • 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-25T15:08:03+00:00Added an answer on May 25, 2026 at 3:08 pm

    put all the updates to the static variable in a synchronized static method and use only that for making updates.

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

Sidebar

Related Questions

Currently I'm writing an ASP.net webforms app, which works with a table containing 15
I'm writing an app which for various reasons involves Internet Explorer (IE7, for the
I am writing an Android app which submits a username and password to a
I am writing an app that has an initial view containing 2 buttons -
Currently I'm writing an app for OSX which will eventually need to be ported
I'm writing delphi app which should have capability of loading plugins. I'm using JvPluginManager
I'm writing an app which will rely heavily on the use of a database.
I'm writing an app to help facilitate some research, and part of this involves
I'm writing an app that will need to make use of Timer s, but
I'm writing an app using asp.net-mvc deploying to iis6. I'm using forms authentication. Usually

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.