How to show loading dialog or Loading spinner in Android - SpartaCode

SpartaCode

Make your development faster and easier !

How to show loading dialog or Loading spinner in Android



Its very important to show a loading dialog to user when some process is going in background.
So, lets implement such loading dialog using a util file which can be used in any of your project you do.

Download LoadingSpinner.java


How to use LoadingSpinner.java ?

Note: First Copy paste LoadingSpinner.java file into your project and then follow these steps.

Step 1 : Declare it in your Activity file 

 LoadingSpinner loadingSpinner;


Step 2 : Initialize loadingSpinner as follows in onCreate() method

 loadingSpinner=new LoadingSpinner(this,"Call will be created soon...");


Step 3 : To open or close dialog use following code 

 loadingSpinner.startSpinner();


 loadingSpinner.stopSpinner();


Thank you 
Please like and subscribe

No comments:

Post a Comment

News

Get Amazing Traffic to your Site

Traffic Exchange

Post Bottom Ad

Responsive Ads Here