Code example for ProgressBar

Methods: setVisibility

0
        progressBar.setVisibility(View.INVISIBLE);
    } 
 
    public void load() { 
        word.setVisibility(View.INVISIBLE);
        progressBar.setVisibility(View.VISIBLE);
    } 
 
    public void complete() { 
        word.setVisibility(View.VISIBLE);
        progressBar.setVisibility(View.INVISIBLE);
    } 
 
    public boolean isLoading() { 
        return progressBar.getVisibility() == View.VISIBLE;
    } 
 
    public void setErrorMessage(String errorMessage) {
        complete(); 
        this.word.setText(errorMessage);
        this.word.setTextColor(getContext().getResources().getColor(R.color.red));