zoukankan      html  css  js  c++  java
  • android开发之splash闪屏页判断是否第一次进入app代码

    package com.david.david.zhankudemo.activity;
    
    import android.app.Activity;
    import android.content.Context;
    import android.content.Intent;
    import android.os.Bundle;
    import android.os.Handler;
    import android.os.Message;
    import android.view.Window;
    import android.widget.ImageView;
    
    import com.david.david.zhankudemo.Constant.SPManager;
    import com.david.david.zhankudemo.R;
    /**
     * 作者:David on 2016/3/14 14:47
     * <p/>
     * 联系QQ:986945193
     * <p/>
     * 微博:http://weibo.com/mcxiaobing
     */
    public class SplashActivity extends Activity {
    
        private ImageView iv_splash;
    
        private Context mContext;
    
        private Handler mHandler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);
                if (SPManager.IS_FIRST_START_APP) {
                    Intent intent = new Intent(mContext, GuideActivity.class);
                    SPManager.IS_FIRST_START_APP = false;
                    startActivity(intent);
                    finish();
                } else {
                    Intent intentMain = new Intent();
                    intentMain.setClass(getApplicationContext(), MainActivity.class);
                    mContext.startActivity(intentMain);
                    finish();
    
                }
    
            }
        };
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.activity_splash);
            mContext = this;
            iv_splash = (ImageView) findViewById(R.id.iv_splash);
    
    
    //        new CreatShortCutUtils(SplashActivity.this).addShortcut();
    //        AlphaAnimation start = new AlphaAnimation(0.0f, 0.1f);
    //        start.setDuration(1000);
    //        iv_splash.startAnimation(start);
    
            loadSplashImage();
        }
    
        private void loadSplashImage() {
            mHandler.sendEmptyMessageDelayed(1, 2000);
    
    
        }
    
        @Override
        protected void onDestroy() {
            super.onDestroy();
            mHandler.removeMessages(1);
        }
    }

    程序员小冰博客:http://blog.csdn.net/qq_21376985 技术交流QQ986945193 微博:http://weibo.com/mcxiaobing
  • 相关阅读:
    Quit Procrastinating! 20 Ways to Energize Out of Your Slump
    [转]会让你人生失败的31种原因
    Control Panel Applets
    MemTest
    The server at www.abstractspoon.com is taking too long to respond.
    拖延者 <<拖延心理学>>
    [转]How to Uninstall Windows Movie Maker
    经典街机
    Causes and Cures for Procrastination
    给页面添加关键词和简介
  • 原文地址:https://www.cnblogs.com/mcxiaobing/p/5472109.html
Copyright © 2011-2022 走看看