Create progress bar java programming

Progress bar is necessary in every project to create a loading menu and give info to user for waiting loading their content. Here is some code for developers to create progress bar. this code use their as they(developer) want.

Horizontal progress bar code

 ProgressBar tp = new ProgressBar(this,null, android.R.attr.progressBarStyleHorizontal); linear1.addView(tp,700,30); tp.setIndeterminate(true);

Circle progress bar code

ProgressBar msg = new ProgressBar(MainActivity.this);  linear1.addView(msg);

Create progress bar in dialog box

 final ProgressDialog prog = new ProgressDialog(MainActivity.this);prog.setMax(100);prog.setTitle("Hello");prog.setMessage("Message");prog.setIndeterminate(true);prog.setCancelable(false);;

Show progress bar in dialog box

 final ProgressDialog prog = new ProgressDialog(MainActivity.this); prog.setMax(100); prog.setTitle("Your Title"); prog.setMessage("Your Message"); prog.setIndeterminate(true); prog.setCanceledOnTouchOutside(false);;

This code also can used for sketchwere. add sdd source directly block and past the code.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.