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.

  • 相关阅读:
    android监控来电显示
    android 选择本地图片并预览
    解决android http请求带中文参数会乱码(url编码)
    android连接webservice是cookies和session保持方法
    eclipse中android自动补全/提示卡机或假死
    JS中创建类得几种方式
    AJAX的简单实例应用
    JavaScript中的eval函数的用法
    JSON 入门指南
    JS中关于clientWidth、offsetWidth、scrollWidth
  • 原文地址:https://www.cnblogs.com/ll-ouyang/p/6281728.html
Copyright © 2011-2022 走看看