Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: arindamhit on May 7th, 2012  |  syntax: None  |  size: 1.25 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.                 /**
  2.                  *  Use to show Loading... text while splash screen is loading. Here after each 350 milliseconds, i am adding
  3.                  *  a single dot(.) using thread and showing in the text view. And after reaching 3 dots, procedure is iterating itself again.
  4.                  *  This code will run till 3500 milliseconds.
  5.                  */
  6.                
  7.                 for (int i = 350; i <= SPLASHTIME; i = i + 350) {
  8.                         final int j = i;
  9.                         handler.postDelayed(new Runnable() {
  10.                                 public void run() {
  11.                                         if (j / 350 == 1 || j / 350 == 4 || j / 350 == 7
  12.                                                         || j / 350 == 10) {
  13.                                                 tvLoadingdots.setText(".");
  14.                                         } else if (j / 350 == 2 || j / 350 == 5 || j / 350 == 8) {
  15.                                                 tvLoadingdots.setText("..");
  16.                                         } else if (j / 350 == 3 || j / 350 == 6 || j / 350 == 9) {
  17.                                                 tvLoadingdots.setText("...");
  18.                                         }
  19.                                 }
  20.                         }, i);
  21.                 }
  22.  
  23.                
  24.                 Runnable runnable = new Runnable() {
  25.                         public void run() {
  26.                                 if(true == mRegistrationSucessful) {
  27.                                         if  (true){
  28.                                         startActivity(new Intent(SplashScreenActivity.this,
  29.                                                         LoginScreenActivity.class));
  30.                                         finish();      
  31.                                         }
  32.                                 } else {
  33.                                         displayAlertDialog(getString(R.string.connection_err));//"Connection Error: Please check & re-start application");
  34.                                 }
  35.                         }
  36.                 };
  37.                 mHandler = new Handler();
  38.                 mHandler.postDelayed(runnable, SPLASHTIME);