| import android.app.Activity; |
| import android.content.Intent; |
| import android.graphics.PixelFormat; |
| import android.os.Bundle; |
| import android.view.Window; |
| import android.view.animation.Animation; |
| import android.view.animation.AnimationUtils; |
| import android.widget.ImageView; |
| import android.widget.LinearLayout; |
|
|
| public class Splashscreen extends Activity { |
| public void onAttachedToWindow() { |
| super.onAttachedToWindow(); |
| Window window = getWindow(); |
| window.setFormat(PixelFormat.RGBA_8888); |
| } |
| /** Called when the activity is first created. */ |
| Thread splashTread; |
| @Override |
| public void onCreate(Bundle savedInstanceState) { |
| super.onCreate(savedInstanceState); |
| setContentView(R.layout.activity_splashscreen); |
| StartAnimations(); |
| } |
| private void StartAnimations() { |
| Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha); |
| anim.reset(); |
| LinearLayout l=(LinearLayout) findViewById(R.id.lin_lay); |
| l.clearAnimation(); |
| l.startAnimation(anim); |
|
|
| anim = AnimationUtils.loadAnimation(this, R.anim.translate); |
| anim.reset(); |
| ImageView iv = (ImageView) findViewById(R.id.splash); |
| iv.clearAnimation(); |
| iv.startAnimation(anim); |
|
|
| splashTread = new Thread() { |
| @Override |
| public void run() { |
| try { |
| int waited = 0; |
| // Splash screen pause time |
| while (waited < 3500) { |
| sleep(100); |
| waited += 100; |
| } |
| Intent intent = new Intent(Splashscreen.this, |
| MainActivity.class); |
| intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); |
| startActivity(intent); |
| Splashscreen.this.finish(); |
| } catch (InterruptedException e) { |
| // do nothing |
| } finally { |
| Splashscreen.this.finish(); |
| } |
|
|
| } |
| }; |
| splashTread.start(); |
|
|
| } |
|
|
| } |
0 Comments:
Post a Comment
FOLLOW US ON FACEBOOK: https://www.facebook.com/unitechsity
:::. .:::
:::. .:::
Share or Like this Post - if you Find it Informative and Cool…
Thanks. Never miss any of my future post
CLICK HERE TO SUBSCRIBE
http://feedburner.google.com/fb/a/mailverify?uri=unitechsity
Once entered, you will have to check your inbox for a confirmation email containing a confirmation link. Once you VERIFY your email by clicking on the confirmation link in the message, you will never miss any future articles.
.
Note: only a member of this blog may post a comment.
Subscribe to Post Comments [Atom]
<< Home