基本信息
源码名称:android 欢迎,引导界面 示例源码下载
源码大小:1.90M
文件格式:.zip
开发语言:Java
更新时间:2014-04-25
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍



package com.yangyu.myguideview04;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;


/**
 * 功能描述:欢迎界面
 * @author john
 *
 */
public class Welcome extends Activity implements Runnable {
    
    /**
     * 是否是第一次使用
     */
    private boolean isFirstUse;
    
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        /**
         * 启动一个延迟线程
         */
        new Thread(this).start();
    }

    public void run() {
        try {
            /**
             * 延迟两秒时间
             */
            Thread.sleep(2000);
            
            //读取SharedPreferences中需要的数据
            SharedPreferences preferences = getSharedPreferences("isFirstUse",MODE_WORLD_READABLE);

            isFirstUse = preferences.getBoolean("isFirstUse", true);

            /**
             *如果用户不是第一次使用则直接调转到显示界面,否则调转到引导界面
             */
            if (isFirstUse) {
                startActivity(new Intent(Welcome.this, GuideActivity.class));
            } else {
                startActivity(new Intent(Welcome.this, MainActivity.class));
            }
            finish();
            
            //实例化Editor对象
            Editor editor = preferences.edit();
            //存入数据
            editor.putBoolean("isFirstUse", false);
            //提交修改
            editor.commit();


        } catch (InterruptedException e) {

        }
    }
}