Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Hi there i have an Asynctask that wroks only problem is the screen is blank until everything has loaded so i have created a loadingcell view but i'm wanting to know how to have it show the loading view until everything is loaded.

here what i have tried but it doesn't work

public class PostTask extends AsyncTask<Void, String, Boolean> {



        @Override
        protected Boolean doInBackground(Void... params) {
            boolean result = false;


            loadFixtures();
            publishProgress("progress");
            loadResultsFeed();
            publishProgress("progress");
            loadNewsFeed();
            publishProgress("progress");
            return result;
        }


        protected void onProgressUpdate(String... progress) {
            StringBuilder str = new StringBuilder();
                for (int i = 1; i < progress.length; i++) {
                    str.append(progress[i] + " ");

                  loadingView = LayoutInflater.from(getBaseContext()).inflate(R.layout.loadingcell,
                         null);

                }
        }

            @Override
        protected void onPostExecute(Boolean result) {
            super.onPostExecute(result);
            Log.v("BGThread", "begin fillin data");
             FillData();
        }
    }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
182 views
Welcome To Ask or Share your Answers For Others

1 Answer

protected void onPostExecute(Boolean result) {
        super.onPostExecute(result);
        Log.v("BGThread", "begin fillin data");
         FillData();
     // hide your view here                                <---------
     // for ex:    
      progressbar.setVisibility(View.GONE);                <---------

    }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...