The Android Development Tutorials blog contains Basic as well as Advanced android tutorials.Go to Android Development Tutorials to get list of all Android Tutorials.
ProgresBar
ProgressBar is a Visual indicator of progress in some operation. Displays a bar to the user representing how far the operation has progressed; the application can change the amount of progress (modifying the length of the bar) as it moves forward. There is also a secondary progress displayable on a progress bar which is useful for displaying intermediate progress, such as the buffer level during a streaming playback progress bar.
Progress Bar Example
In this example I have shown the progress while downloading a file.We can also customize a progress bar to make it more beautiful
.Read How To Customize Progress Bar
Customizing Toast In Android
Showing Toast for Longer Time
Customizing Checkboxes In Android
Customizing Progress Bar
To learn Basic of Android Animation go to Android Animation Basics
main..xml
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/textView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:gravity="center_horizontal"
android:textSize="25dp"
android:text="Progress Bar Example" />
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:onClick="startProgressDialog"
android:text="Start Downloading File" />
</LinearLayout>
Note: To add a progress bar to a layout file, you can use the
<ProgressBar>
element.
By default, the progress bar is a spinning wheel (an indeterminate indicator). To change to a
horizontal progress bar, apply the Widget.ProgressBar.Horizontal
style, like so:ProgressBarActivity.java
public class ProgressBarActivity extends Activity
{
Button btnStartProgress;
ProgressDialog progressBar;
private int progressBarStatus = 0;
private Handler progressBarHandler = new Handler();
private long fileSize = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void startProgressDialog(View V)
{
// prepare for a progress bar dialog
progressBar = new ProgressDialog(V.getContext());
progressBar.setCancelable(true);
progressBar.setMessage("Downloading File...");
progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressBar.setProgress(0);
progressBar.setMax(100);
progressBar.show();
//reset progress bar status
progressBarStatus = 0;
//reset filesize
fileSize = 0;
new Thread(new Runnable() {
public void run() {
while (progressBarStatus < 100) {
// process some tasks
progressBarStatus = fileDownloadStatus();
// sleep 1 second to show the progress
try {
Thread.sleep(1000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
// Update the progress bar
progressBarHandler.post(new Runnable() {
public void run() {
progressBar.setProgress(progressBarStatus);
}
});
}
// when, file is downloaded 100%,
if (progressBarStatus >= 100) {
// sleep 2 seconds, so that you can see the 100% of file download
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// close the progress bar dialog
progressBar.dismiss();
}
}
}).start();
}
//method returns the % of file downloaded
public int fileDownloadStatus()
{
while (fileSize <= 1000000) {
fileSize++;
if (fileSize == 100000) {
return 10;
} else if (fileSize == 200000) {
return 20;
} else if (fileSize == 300000) {
return 30;
} else if (fileSize == 400000) {
return 40;
} else if (fileSize == 500000) {
return 50;
} else if (fileSize == 600000) {
return 60;
}
// write your code here
}
return 100;
}
We can also customize a progress bar to make it more beautiful
.Read How To Customize Progress Bar
New Advance Topics:
Android ImageSwitcher Android TextSwitcher Android ViewFlipper
Android Gesture Detector Handling/Detecting Swap Events Gradient Drawable
Detecting Missed Calls Hide Title Bar GridView Animation
Beginning With Android
Android : Introduction Configuring Eclipse for Android Development
Creating Your First Android Project Understanding Android Manifest File of your android app
Advance Android Topics Customizing Android Views
Working With Layouts Working With Views
Understanding Layouts in Android Using Buttons and EditText in Android
Working with Linear Layout (With Example) Using CheckBoxes in Android
Nested Linear Layout (With Example) Using AutoCompleteTextView in Android Grid View
Relative Layout In Android ListView
Table Layout Android ProgressBar
Frame Layout(With Example) Customizing ProgressBar
Absolute Layout Customizing Radio Buttons
Grid Layout Customizing Checkboxes In Android
Android Components Dialogs In Android
Activity In Android Working With Alert Dialog
Activity Life Cycle Adding Radio Buttons In Dialog
Starting Activity For Result Adding Check Boxes In Dialog
Sending Data from One Activity to Other in Android Creating Customized Dialogs in Android
Returning Result from Activity Creating Dialog To Collect User Input
Android : Service DatePicker and TimePickerDialog
BroadcastReceiver Using TimePickerDialog and DatePickerDialog In android
Menus In Android ListView:
Creating Option Menu Populating ListView With DataBase
Creating Context Menu In Android Populating ListView with ArrayList
ListView with Custom Adapter
Toast Working With SMS
Customizing Toast In Android How to Send SMS in Android
Customizing the Display Time of Toast How To Receive SMS
Customizing Toast At Runtime Accessing Inbox In Android
Adding Image in Toast
Showing Toast for Longer Time
TelephonyManager Storage: Storing Data In Android
Using Telephony Manager In Android SharedPreferences In Android
Reading and Writing files to Internal Stoarage
Working With Incoming Calls DataBase
How To Handle Incoming Calls in Android Working With Database in Android
How to Forward an Incoming Call In Android Creating Table In Android
CALL States In Android Inserting, Deleting and Updating Records In Table in Android
Miscellaneous
Notifications In Android
How To Vibrate The Android Phone
Sending Email In Android
Opening a webpage In Browser
How to Access PhoneBook In Android
Prompt User Input with an AlertDialog
sir,is it displaying P.Bar after clicking the Button or else it start after button ?
ReplyDeleteIt starts progress bar after clicking on Button "Start Downloading File"
DeleteThis is NOT an example of the progressBar it is an example of the progressDialog. There is a large difference. progressBar will be a part of the current layout and will update and the user will still be able to navigate the current layout/activity. progressDialog takes over the current activity and requires the user to wait for it to finish. Please correct this, you are misleading the young developers like myself. Thank you.
ReplyDeleteGeneгally I don't read artіcle on Ƅlogs, but I wish to say that thіs write-up very compelled me to take a
ReplyDeletelook at and do so! Your writing taste has been surprised me.
Thank you, quite great articⅼe.
casino games slots
ReplyDeletecasino games real money
casinos online
casino online
online gambling casino
Do you have a spam problem on this site; I also am a blogger, and I was wondering your situation;
ReplyDeletewe have developed some nice practices and we are looking to exchange solutions with other folks, why
not shoot me an email if interested.
This website truly has all of the information I wanted
ReplyDeleteconcerning this subject and didn't know who to ask.
It's impressive that you are getting thoughts from this piece of writing as well as from our argument
ReplyDeletemade at this time.
Oh my goodness! Incredible article dude! Many
ReplyDeletethanks, However I am experiencing troubles with your RSS.
I don't know why I can't join it. Is there anybody else getting similar RSS issues?
Anybody who knows the solution can you kindly respond?
Thanks!!
http://www.micropromocodes.com Best Place
ReplyDeletefor Upto 80% Off Free Coupon Codes, Promotion Codes, Discount Deals and Promo Offers For Online Shopping,Upto 80% Off Promo Coupon Codes.
Save on Online Shopping Always. Use Coupons.
Exclusive Coupons · Genuine Offers · Updated Daily · Best Coupons · Free Coupons · Best Offers,
Types: Coupon Codes, Discount Coupons, Offers &
Deals,Save Upto 80% Off on Microsoft Store Promo Code,
Having read this I believed it was really informative.
ReplyDeleteI appreciate you finding the time and effort to
put this information together. I once again find myself spending way too much time both reading and leaving comments.
But so what, it was still worth it!
Microsoft Online Store offers various Promotional Codes on different products like Microsoft Office
ReplyDelete2019, Visual Studio 2018,
Office 365, Xbox, Windows 10 .etc. At http://www.micropromocodes.com you
can get these
Microsoft Promo Code 2019 to avail the great discounts.
First off I want to say great blog! I had a quick question that
ReplyDeleteI'd like to ask iff you do not mind. I was interested to know how you center yourself and clear your mind before writing.
I have had difficulty clearing my thoughts in getting myy thoughts out there.
I truly do take pleasure in writing but it just seems like the first 10
to 15 minutes are usually lost simply just trying to figure out
how to begin. Any suggestions or hints? Cheers!
Woah! I'm really loving the template/theme of this site.
ReplyDeleteIt's simple, yet effective. A lot of times it's very
hard to get that "perfect balance" between superb
usability and visual appeal. I must say you've done
a amazing job with this. Also, the blog loads super fast
for me on Opera. Excellent Blog!
We refer instead, on the free online competitions that are
ReplyDeleteconducted online from the hundreds every day.
Perhaps the most potent spelling word games
is usually to challenge your sons or daughters to publish their particular
folk stories, original poetry, or musicals employing a tremendous variety of their words.
Visual displays could be designed to show any airport or terrain on earth through the flight simulator.
In many ways, this is regarded as something important that you would
ReplyDeletewant to look at before going to a higher step. Prior to the
beginning in the deal from the dealer, the players are
needed to lay down their bets for the Blackjack
table. From blackjack to baccarat strategy, everyone appears to have a fail-proof way to beat
the casino games.
♦ bhm.vn là website chuyên mua hàng mỹ.Bạn có thể mua hàng trên Ebay hay tại Emerson Fry và nhiều trang shopping online khác nữa
ReplyDelete. với giá cả có thể gọi là rẻ nhất bây giờ và thời gian chuyển hàng mau
chóng . Bạn sẽ cảm thấy hài lòng với dịch vụ mua hàng hộ của bhm.vn.
+ với trang tin tức bloghangmy.com là trang review và phân tích các sản phẩm
đang là hot trend hiện nay của giới trẻ.
+ Với giá dịch vụ chỉ 3.5 đến 5%.
+ Và giá gửi hàng từ 6-7$/ 1kg
+ giá Phụ thu thương chính với những món hàng đặc thù thấp hơn các
dịch vụ khác.
+ trang web với hệ thống báo giá tự động chi
tiết và phần "tự tính giá" . Anh chị em sẽ có được bảng báo giá của món hàng chỉ trong vài phút.
dù Anh chị em tư vấn viên không trả lời bạn liền thì bạn cũng có thể tự tính giá cho món hàng minh
cần mua .
+ với hình thức thanh đơn giản, hoàn toàn sẽ không
sảy ra rủi ro. Cả nhà có thể thanh toàn trực
tiếp qua nhà băng hay tại cửa hàng bhm.
+ Các bạn tư vấn viên tận tình hỗ trợ thì mọi
câu hỏi của Anh chị em về sản phẩm mình muốn mua sẽ được giải quyết
trong thời gian ngắn nhất có thể.
+ chuyển hàng trên khắp cả nước
, tại mọi nơi toàn quốc mau chóng và an toàn.
+ Sẵn sàng cộng tác với Anh chị nếu như muốn khiến cho reseller cho bhm.vn
♥♥♥ tin sốc, bhm.vn có rất nhiều tiết mục ưu đãi
và chế độ hậu mãi rất khả quan chắc
chắn| sẽ đem lại rất nhiều lợi ích và thuận lợi cho Anh chị em khi tìm hàng.
♦ bhm.vn là website chuyên mua hàng hộ hàng mỹ.Bạn có thể mua hàng trên Amazon hay
ReplyDeletetại Nasty Gal và nhiều trang shopping online
khác nữa . có số tiền mà phải bỏ ra có thể gọi là "chất" nhất ngày nay và thời gian chuyển hàng nhanh chóng .
Bạn sẽ cảm thấy hài lòng với wesbite của buonhangmy.com.
+ website tin tức bloghangmy.com là website review và tìm
hiểu các món hàng đang là hot nhất bây giờ
của mạng xã hội.
+ Với giá dịch vụ chỉ 3.5 đến 5%.
+ Và giá ship hàng chỉ 6-7$/ 1kg
+ phí Phụ thu thương chính với các món hàng đặc trưng tốt hơn các dịch vụ khác.
+ website có hệ thống báo giá tự động chi tiết và phần "tự tính giá" .
Cả nhà sẽ nhận được được bảng báo giá của món hàng chỉ trong vài phút.
dù Các bạn tư vấn không trả lời bạn liền thì
bạn cũng có thể tự tính giá cho món hàng minh cần tìm .
+ với hình thức thanh đơn thuần, hoàn toàn sẽ ko sảy ra rủi ro.
Anh chị em có thể thanh toàn trực tiếp qua bank hay
tại cửa hàng bhm.
+ Các bạn tư vấn viên tận tâm hỗ trợ thì mọi câu
hỏi của Anh chị em về món hàng mình muốn tìm sẽ được giải quyết với
thời gian nhanh nhất có thể.
+ Giao hàng trên toàn quốc , tại mọi nơi khắp cả nước
mau chóng và an toàn.
+ Sẵn sàng cộng tác với Anh chị nếu muốn làm
cho reseller cho bhm.vn
♥♥♥ đặc biệt, bhm.vn với rất nhiều tiết mục khuyến mại và chế độ hậu mãi rất tốt
chắc chắn| sẽ mang lại rất nhiều lợi ích và thuận tiện cho Anh chị
lúc tìm sản phẩm.
Hi! I'm at work browsing your blog from my new iphone!
ReplyDeleteJust wanted to say I love reading your blog and look forward to all your posts!
Keep up the superb work!
"These two numbers have a probability of 4.78% for the European wheel and 4.77% for the American wheel, with all other numbers having a probability of 2.58% (Europen) and 2.51% (American)" GXKSoundBite roulette
ReplyDelete