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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:41:47+00:00 2026-06-18T18:41:47+00:00

In my project i defined an interface like this: public interface SearchResultProgressListener { public

  • 0

In my project i defined an interface like this:

public interface SearchResultProgressListener {
    public void OnSearchCompleted(boolean value);
}

I’ve implemented this in class A (called SearchResultsActivity):

public class SearchResultsActivity extends BaseActivity implements
         SearchResultProgressListener {

    private ProgressBar mProgressBar;
    private boolean timerStatus = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_searchresults);

        // Linking progressbar
        mProgressBar = (ProgressBar) findViewById(R.id.progressBar_fake);
        new CountDownTimer(10000, 1000) {

             public void onTick(long millisUntilFinished) {
                 int temp = (int) millisUntilFinished / 1000;
                 switch(temp) {
                     case 9: temp = 1;   break;
                     case 8: temp = 2;   break;
                     case 7: temp = 3;   break;
                     case 6: temp = 4;   break;
                     case 5: temp = 5;   break;
                     case 4: temp = 6;   break;
                     case 3: temp = 7;   break;
                     case 2: temp = 8;   break;
                     case 1: temp = 9;   break;
                     case 0: temp = 10;  break;
                 }
                 Log.e("Hesam", "Status1: " + timerStatus);
                 if(!timerStatus)
                     mProgressBar.setProgress(temp);
                 else
                     mProgressBar.setProgress(10);
             }

             public void onFinish() {
                 mProgressBar.setVisibility(View.GONE);
             }
          }.start();
    }

    @Override
    public void OnSearchCompleted(boolean status) {
        this.timerStatus = status;
        Log.e("Hesam", "Status0: " + timerStatus);
    }
}

I have class B (called HotelsAsyncTaskFragment) that through this class I want to send Boolean to class A.

public class HotelsAsyncTaskFragment extends SherlockFragment {
    private SearchResultProgressListener srpListener;

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        srpListener = (SearchResultProgressListener) new SearchResultsActivity();
    }

    class HotelsSearchTask extends AsyncTask<Void, Void, Void> {

        @Override
        protected void onPreExecute() {...}

        @Override
        protected Void doInBackground(Void... params) {...}

        @Override
        protected void onPostExecute(Void result) {
            if(!isComplete()) {
                HotelsAsyncTaskFragment.this.srpListener.OnSearchCompleted(false);
                } else { 
            HotelsAsyncTaskFragment.this.srpListener.OnSearchCompleted(true);
                }
    }
    }
}

Now, I expect when I setting “timerStatus” in class A to “True”, it’s content changes but it doesn’t. This is my Log:

02-13 16:41:58.716: E/Hesam(469): Status1: false
02-13 16:42:13.566: E/Hesam(469): Status1: false
02-13 16:42:14.566: E/Hesam(469): Status1: false
02-13 16:42:14.611: E/Hesam(469): Status0: true
02-13 16:42:15.571: E/Hesam(469): Status1: false
02-13 16:42:16.601: E/Hesam(469): Status1: false
02-13 16:42:17.616: E/Hesam(469): Status1: false
02-13 16:42:18.616: E/Hesam(469): Status1: false
02-13 16:42:19.621: E/Hesam(469): Status1: false
02-13 16:42:20.626: E/Hesam(469): Status1: false
02-13 16:42:21.621: E/Hesam(469): Status1: false

As you can see, “timerStatus” is set to “true” in forth line but after that I have no idea why it is set to false!!!

any suggestion would be appreciated. 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-18T18:41:48+00:00Added an answer on June 18, 2026 at 6:41 pm

    You haven’t shown the code for SearchResultsActivity() but it’s clearly not the same as MainActivity(). The log entries you are seeing are coming from two different activities with two separate variables.

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

Sidebar

Related Questions

If I set a Friend-level scope on a setter, like this... Public Class MyClass
I currently am part of a project where there is an interface like this:
I have a set of user controls which are defined like so.. public class
I have the following defined in a file called build-dependencies.xml <?xml version=1.0 encoding=UTF-8?> <project
I have a number of class, all with exactly the same interface. This interface
I'm building a rest interface in an existing project. The project has a class
In a project at work we have a certain value type class in our
Possible Duplicate: Static members class vs. normal c-like interface I am looking at somebodies
My application has the following types defined public interface IUser { int Id {
The scenario goes like this - I have an assembly say 'MyAssembly'. An interface

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.