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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:42:44+00:00 2026-05-23T19:42:44+00:00

Here’s the scenario I have an activity(A) which has a button and textview. I

  • 0

Here’s the scenario

I have an activity(A) which has a button and textview. I have another class(B) with methods for performing various functions. After creating an instance of class B, one of it’s public method is called from A when the button is clicked. The method takes a while to execute(it invokes another time consuming private methods in the class) and returns the value of one of the private members of class B.

The trouble is that the method returns the initial value of the member and not the values after computation. Is there way to force the function to wait for some time and return the value of member of computation?

public String getItem(){
        startFunction(); //Time consuming Function
        generateItem(); //Function which uses results of startFunction() to generate item and set values to mItem
        return mItem; //mItem is the private member of class B
    }

The value returned always is the default value of mItem i.e value set in the constructor. The time taken by startFunction(WiFi Scanning) is arbitrary. Any help would be much appreciated.

  • 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-23T19:42:46+00:00Added an answer on May 23, 2026 at 7:42 pm

    When you create an instance of class B make sure it takes Context as an argument in its constructor. Then you can try using AsyncTask (Assuming you know it). Then put the time consuming function in doInBackground() and the function which waits for its values in onPostExecute()

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

Sidebar

Related Questions

Here is an example: I have a file 1.js, which has some functions. I
Here's my scenario - I have an SSIS job that depends on another prior
Here's my scenario: <!-- Normal Control --> <div class=required> <label for=address1>Address line 1</label> <input
Here is my code (Say we have a single button on the page that
Here's a Clone() implementation for my class: MyClass^ Clone(){ return gcnew MyClass(this->member1, this->member2); }
Here's the basic setup: I have a thin bar at the top of a
Here is my problem : I have a post controller with the action create.
Here is an example: I have the generic type called Account. I wish to
Here is a link to the page. The Home button is supposed to be
Here I have an int x=3; NSLog(@%i, x); How to have it displayed like

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.