Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to make Animated waiting Progressbar in android.

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 147
    Comment on it

    Here I have created Animated waiting bar. It can be used to display page or when we have app open then it will shown status of work being complete.Progressbar class provide method to work on progress bar like setProgress(),setMessage,setProgressStyle(),show() etc. Below example will described you how to make Animated Progressbar in android.

    Step(1)-Main.Layout-

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
        android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
        android:background="#006699">
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Inder"
            android:id="@+id/textView"
            android:layout_centerVertical="true"
            android:layout_centerHorizontal="true"
            android:textColor="#ffffff" />
    
        <ProgressBar
            style="?android:attr/progressBarStyleLarge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/progressBar"
            android:layout_alignBottom="@+id/textView"
            android:layout_centerHorizontal="true" />
    
    </RelativeLayout>
    

    Step(2)-MainActivity-

    public class MainActivity extends Activity {
    
        private static final String TAG ="buckyMessage";
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            Log.i(TAG,"onCreate");
        }
        @Override
        protected void onStart(){
            super.onStart();
            Log.i(TAG,"onStart");
        }
        @Override
        protected void onResume(){
            super.onResume();
            Log.i(TAG,"onResume");
        }
        @Override
        protected void onPause(){
            super.onPause();
            Log.i(TAG,"onPause");
        }
        @Override
        protected void onStop(){
            super.onStop();
            Log.i(TAG,"onStop");
        }
        @Override
        protected void onRestart(){
            super.onRestart();
            Log.i(TAG,"onRestart");
        }
    
        @Override
        protected  void onSaveInstanceState(Bundle outState){
             super.onSaveInstanceState(outState);
            Log.i(TAG,"onSaveInstanceState");
        }
        @Override
        protected void onRestoreInstanceState(Bundle savedInstanceState){
            super.onRestoreInstanceState(savedInstanceState);
            Log.i(TAG,"onRestoreInstanceState");
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.menu_main, menu);
            return true;
        }
    
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.
            int id = item.getItemId();
    
            //noinspection SimplifiableIfStatement
            if (id == R.id.action_settings) {
                return true;
            }
    
            return super.onOptionsItemSelected(item);
        }
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: