a simple issue here, but one I haven't been able to find a simple solution for. My Android app has a button that calls a calculations-heavy method which may take a while to return results. I want the user to know that the app is working, not frozen, so upon hitting that button I want to display a textView with a loading message, then call the method and load its results to another textView (while also hiding the first one). How can I make sure the method is started only AFTER the loading message becomes visible, because the code below fires the method when it's still not visible?
buttonCalculate.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
loadingMessage.setVisibility(View.VISIBLE);
findSolution();
}
});
you are looking for a Progress Bar, it's a an android feature that android made for you. Here is a link for the official google site: https://developer.android.com/reference/android/widget/ProgressBar