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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:12:40+00:00 2026-06-11T09:12:40+00:00

I have an activity class as below. public class LoginActivity extends Activity implements OnClickListener

  • 0

I have an activity class as below.

public class LoginActivity extends Activity implements OnClickListener {
   @Override
   public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      button1 = (ImageView) findViewById(R.id.button1);
      button1.setOnClickListener(this);
   }
   @Override
   public void onClick(View v) {
       loader = (ProgressBar) findViewById(R.id.loader);
       Thread processThread = new Thread(loaderThread); 
       loader.setVisibility(View.VISIBLE);
       processThread.start();

       try {
        Thread.currentThread().join();
        Log.i("Activity","gone past join()");
        loader.setVisibility(View.INVISIBLE);
   } catch (InterruptedException e) {
        e.printStackTrace();
   }
   }

  private Runnable loaderThread = new Runnable() {
 public void run() {
    ServiceCaller serviceCaller = new ServiceCaller();
    boolean status = serviceCaller.checkProcess(url);
  }
  };
}

Further Question [EDITED]
Here is the scenario. The main activity class creates a thread on a click. The then created thread fetches some data from the server. It is a time consuming task. So a progress bar is displayed on the UI. Currently I am using AsyncTask (not shown here) to accomplish server data retrieval. But the real challenge is wait for the background task to complete and get the value from it. What I am looking for is:

wait until server calls are made and get the results. Meanwhile show the progress bar.

Any thoughts? Apologies in case I confuse you.

Thanks in advance!

  • 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-11T09:12:41+00:00Added an answer on June 11, 2026 at 9:12 am

    You must have a look at AsyncTask
    http://developer.android.com/reference/android/os/AsyncTask.html
    http://www.vogella.com/articles/AndroidPerformance/article.html

    and you can show the ProgressBar in onPreExecute()
    do the task in doInBackground()
    and hide the ProgressBar in onPostExecute()

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

Sidebar

Related Questions

I have an activity class as below. public class LoginActivity extends Activity implements OnClickListener
If I have defined a Activity: public class DialogActivity extends Activity{ @Override public void
So i have this activity : public class settings_dock extends Activity { AlertDialog alert;
I have an class as below: public class FYPSmsReceiverBroadcast extends BroadcastReceiver I need to
I have class A which extends the Activity class. This class is in package
I have a list of objects called Activity: class Activity { public Date activityDate;
I have the next code: class Printer{ Activity activity; public Printer (Activity activity) {
Actually i have created an singleton class. Now my singleton class extends Activity, and
I have a LoginActivity.java that imports VersionCheck.java. VersionCheck.java has a class VersionCheck that extends
OK, I have a login class like the snippet below public class LoginClass {

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.