
Untitled
By:
arindamhit on
May 7th, 2012 | syntax:
None | size: 1.25 KB | hits: 14 | expires: Never
/**
* Use to show Loading... text while splash screen is loading. Here after each 350 milliseconds, i am adding
* a single dot(.) using thread and showing in the text view. And after reaching 3 dots, procedure is iterating itself again.
* This code will run till 3500 milliseconds.
*/
for (int i = 350; i <= SPLASHTIME; i = i + 350) {
final int j = i;
handler.postDelayed(new Runnable() {
public void run() {
if (j / 350 == 1 || j / 350 == 4 || j / 350 == 7
|| j / 350 == 10) {
tvLoadingdots.setText(".");
} else if (j / 350 == 2 || j / 350 == 5 || j / 350 == 8) {
tvLoadingdots.setText("..");
} else if (j / 350 == 3 || j / 350 == 6 || j / 350 == 9) {
tvLoadingdots.setText("...");
}
}
}, i);
}
Runnable runnable = new Runnable() {
public void run() {
if(true == mRegistrationSucessful) {
if (true){
startActivity(new Intent(SplashScreenActivity.this,
LoginScreenActivity.class));
finish();
}
} else {
displayAlertDialog(getString(R.string.connection_err));//"Connection Error: Please check & re-start application");
}
}
};
mHandler = new Handler();
mHandler.postDelayed(runnable, SPLASHTIME);