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.

  • 相关阅读:
    centos7 下载并安装.netcore SKD,运行.netcore 应用程序
    小网站到大网站架构的演化之路 学习总结
    suppersocke,websocket 功能学习总结
    定时任务 quartZ
    RabbitMQ 安装和功能点
    rabbitmq 发送 消费消息
    富文本编辑器
    vue AES加密解密
    css动画库
    el-table合并表格
  • 原文地址:https://www.cnblogs.com/ll-ouyang/p/6281728.html
Copyright © 2011-2022 走看看