Konrad J.
Konrad J.

Reputation: 1

Android - Display the loading text

I am trying to display Loading text only when its loading. The problem is im setting it to visible and straight after to invisible once finished loading. But text never has a chance to update. Is there a way to force refresh the screen, or maybe there is another way to do this? Thanks

This is my code

SearchBtn = (Button) findViewById(R.id.SearchButton);

  SearchBtn.setOnClickListener(new OnClickListener() 
  {
     public void onClick(View arg0) 
     {
       //this is never seen because its set straight after to invisible
       LoadingText.setVisibility(View.VISIBLE); 

       SearchFor(EditSearchField.getText().toString()); // all loading done here

       LoadingText.setVisibility(View.INVISIBLE); 

       HideKeyboard();

   }
   });

Upvotes: 0

Views: 78

Answers (1)

Scott Stanchfield
Scott Stanchfield

Reputation: 30652

You need to do the actual load in a separate thread. You'd be best off using an AsyncTask for this. Take a look at http://www.vogella.com/articles/AndroidPerformance/article.html

Upvotes: 2

Related Questions