Issue
I am attempting to hide a ProgressBar
after I load data from Asynctask
, but the progressbar still persist even when I specify View.GONE
.
I have went through different links but wasn't able to get desired results
I am specifying this on onCreate
in my activiy I am specifying following code:
layout =(RelativeLayout) findViewById(R.id.displayLayout);
progressBar = new ProgressBar(DisplayActivity.this,null,android.R.attr.progressBarStyleLarge);
params = new RelativeLayout.LayoutParams(100,100);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
In my Asynctask onPreExecute
event I am specifying following code:
layout.addView(progressBar,params);
progressBar.setVisibility(View.VISIBLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
OnPostExecute
I am specifying following code:
progressBar.setVisibility(View.GONE);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
I have almost tried everything from following links:
Android - ProgressBar setVisibility to GONE not working
Android, setVisbility to gone not working in RelativeLayout
Solution
I hope it will works for you.Try add progressbar onCreate method
layout.addView(progressBar,params); progressBar.setVisibility(View.GONE); Then onPreExecute just setVisibility
progressBar.setVisibility(View.VISIBLE); and onPostExecute just hide ProgressBar
progressBar.setVisibility(View.GONE);
Answered By - Chetan Ansel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.