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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:23:04+00:00 2026-05-24T21:23:04+00:00

Here is a pseudo code : class MoWeFi extends Activity static TouchSurfaceView TSV; static

  • 0

Here is a pseudo code :

class MoWeFi extends Activity

    static TouchSurfaceView TSV;
    static DrawRenderer mRenderer;
    static UserInterface mUI;
    DownloadData mDD = new DownloadData();
    static float zoom = 1.f;

    mDD.execute();
    mUI = new UserInterface();
    setContentView(mUI);

class UserInterface extends LinearLayout
MoWeFi.TSV = new TouchSurfaceView(context);
MoWeFi.mRenderer = new DrawRenderer(context);
MoWeFi.TSV.setRenderer(MoWeFi.mRenderer);
MoWeFi.TSV.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
this.addView(MoWeFi.TSV);

    TextView tv = new TextView(context);
    this.addView(tv);

    TextView tv2 = new TextView(context);
    this.addView(tv2);

class DownloadData extends AsyncTask
protected Void doInBackground(){
do{
this.publishProgress();
try{Thread.sleep(1000);catch (InterruptedException e){}
}while(running)
}
@Override
protected void onProgressUpdate(){
//...
MoWeFi.TSV.requestRender();
MoWeFi.mUI.tv.setText("zoom="+MoWeFi.zoom); // IT DOES NOT WORK !!! ALWAYS GET 1.f.
}

class TouchSurfaceView extends GLSurfaceView
gl.glTranslatef(0, 0, -1.f / MoWeFi.zoom); // IT WORKS !!!

class DrawRenderer implements GLSurfaceView.Renderer
//Pinch-zoom
...
MoWeFi.zoom *= detector.getScaleFactor();
MoWeFi.zoom = Math.max(0.5f, Math.min(MoWeFi.zoom, 5.0f));

MoWeFi.mUI.tv2.setText("zoom="+MoWeFi.zoom); // IT WORKS !!!

So no error whatsoever. Just not able to access my zoom variable everywhere.
I am new to Java, I am surely missing important concept.

EDIT add float in the first lines

EDIT 2 add publishProgress in the asyncTask

EDIT 3 logcat shows nothing

  • 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-24T21:23:06+00:00Added an answer on May 24, 2026 at 9:23 pm

    Are you sure your AsyncTask accesses the property after the value was changed? If yes, AsyncTask runs code on a separate thread so probably you’re facing a race condition where the value updated in one thread is not yet available in another. Try to make the zoom property volatile:

     public static volatile float zoom = 1.f;
    

    or use synchronized get/set methods to mutate and access the property.

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

Sidebar

Related Questions

I'm designing a method for an input handler class. Here is some pseudo code...
Here is some pseudo code of my setup: class IMyClass { ... }; //
Here is pseudo-code of how I setup an array representing the MandelBrot set, yet
Here is the pseudo-code for my inline query in my code: select columnOne from
I am using pseudo-code here, but this is in JavaScript. With the most efficient
Here's what I'm trying to do -- this is pseudo code and doesn't work.
I have a small problem with interfaces. Here it is in Pseudo code :
here is pseudo code on algorithm to find median of two array T WO
Let's say I have 3 classes. Class A (extends Activity) Class B Class C
I have an object model that looks like this (pseudo code): class Product {

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.