0
ProgressBar loading;
Button login;

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        loading=(ProgressBar)findViewById(R.id.progressBar1);
        login=(Button)findViewById(R.id.button1);

        }

public void loginAuthenticate(View view)
    {
        loading.setVisibility(View.VISIBLE);
        login.setVisibility(View.INVISIBLE);
        Log.v("EditText", uname = txtUname.getText().toString());
        Log.v("EditText", pass = txtPass.getText().toString());
        initControls();
    }

The initControls() is a function that connects to a website and sends login information. I want to display the progressbar after I click the login button but it doesn't appear immediately. It waits for the initControls() to be done before appearing.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by peter_budo
0

You should use AsyncTask or even better Loader that will let you execute activity on thread and you will be able to start and end loader on methods that do on start and on finish

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.