I have created a ProgressBar
programmatically as below in my activity. How do I make it show?
progressBar = new ProgressBar(activity, null, android.R.attr.progressBarStyleSmall);
You can try this code for adding progressBar programaticlly to your layout.
RelativeLayout layout = new RelativeLayout(this);
ProgressBar progressBar = new ProgressBar(YourActivity.this,null,android.R.attr.progressBarStyleLarge);
progressBar.setIndeterminate(true);
progressBar.setVisibility(View.VISIBLE);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(100,100);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.addView(progressBar,params);
setContentView(layout);
progressBar
is a widget (view). You need to add to viewgroup.
You can use ProgressDialog to show progress loading Example:
ProgressDialog proDialog = ProgressDialog.show(this, "title", "message");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With