zoukankan      html  css  js  c++  java
  • 是否第一次登陆,判断引导页(不是第一次登陆,则越过引导页面)

    新手笔记,仅供参考!

    首先定义三个页面

    随后写3个activity定义功能

    package com.example.administrator.mypagelead;

    import android.content.Context;
    import android.content.Intent;
    import android.content.SharedPreferences;
    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import android.view.View;

    public class MainActivity extends AppCompatActivity {

        private SharedPreferences sharedPreferences;
        private SharedPreferences.Editor editor;
        // 判断是否是首次登陆
        private boolean isFirst;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            sharedPreferences=getSharedPreferences("phone", Context.MODE_PRIVATE);
            editor=sharedPreferences.edit();
            isFirst=sharedPreferences.getBoolean("frist",true);

        }
        //欢迎页按钮
        public void huanyingye(View v){
            if(isFirst==true){//第一次登陆
                editor.putBoolean("frist",false);
                editor.commit();
                //跳转到
                Intent intent=new Intent(this,Main2Activity.class);
                startActivity(intent);
            }else {
                // 跳转到
                Intent intent=new Intent(this,Main3Activity.class);
                startActivity(intent);
            }
        }
    }
    ---------2-------

    3.

  • 相关阅读:
    自解代理模式
    顺时针打印二维方阵
    Dom4j官网解释实例
    Eclipse快捷键大全
    MyEclipse快捷键大全
    SQL语句的增删改查(详细)
    MySQL用户权限详细汇总
    从表中随机返回n条记录
    证件照(1寸2寸)拍摄处理知识汇总
    java 实现文件内容的加密和解密
  • 原文地址:https://www.cnblogs.com/ll-ouyang/p/6281728.html
Copyright © 2011-2022 走看看