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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:49:07+00:00 2026-06-02T17:49:07+00:00

I have been able to call an http post process in a new thread,

  • 0

I have been able to call an http post process in a new thread, but the variables sent over the post vary based off of the value of another variable, posttype, set before this thread is run.

The variable that determines what values are sent over the post is set as: public String posttype = "load";

before the new thread is run posttype is set as either “load” or “unload”. Based off of these values, the data sent over post is determined.

the new thread function I use is from: http://android-developers.blogspot.com/2009/05/painless-threading.html

I use the SECOND function shown of runnable from the above link.

Inside the first run() I sent the variables over http. Inside the second run() I parse the returned variable.

The problem is this: I cannot access the value of the posttype and the else statement inside the new thread function is always chosen because the if statement cannot access the variable posttype.

How to I make the variable posttype truly global or usable by a new thread?

Thanks,

  • 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-02T17:49:08+00:00Added an answer on June 2, 2026 at 5:49 pm

    If I get it right you can’t access the variable because it’s not final. If so you can take a final variable of the same type as posttype, assign it that value and use it in the second run.
    To make it more clear check my answer to this question: final variable issue in an inner class

    The listener in that case is run in a situation where the same logic applies.

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

Sidebar

Related Questions

My knowledge of xml and php is somewhat basic but have been able to
I have been able to design my layout so that it has 2 columns
I have been able to set up OBDC in Filemaker, and added table ,
Hi I have been able to extract a VARCHAR to a date using string_to_date
What I have been able to grasp from reading the source and documentation from
I have this excel file which I have been able to write the data
So far the only way I have been able to keep index.yaml updated when
I've been reading similar questions to this issue and have been able to get
I'm having problems refreshing .Net 2.0 with IIS 6. I have been able to
I'm trying to install bcrypt-ruby on Windows Vista. So far, I have been able

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.