维护Study
##老师发了一个study来让我们纠错维护,整个软件是日程管理系统,分为欢迎界面,登录 注册界面,提醒界面添加日程界面,还有个人中心等。一些主要代码老师让我们把缺失部分去维护。首先我们读一下主要代码##
*WelcomActivity是一个欢迎界面,原始老师给的代码为以下代码*
···········
import com.avos.avoscloud.AVUser; import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler; public class WelcomeActivity extends Activity { Handler handler = new Handler(); Runnable runnable = new Runnable() { public void run() {
Intent intent = new Intent(WelcomeActivity.this, LoginActivity.class);
startActivity(intent);
finish(); } }; Runnable runnable1 = new Runnable() { public void run() {
Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
startActivity(intent);
finish(); } }; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
AVUser currentUser = AVUser.getCurrentUser(); if (currentUser != null) {
// 跳转到首页
handler.postDelayed(runnable1, 2000);
} else {
//缓存用户对象为空时,可打开用户注册界面…
handler.postDelayed(runnable, 2000);
} }
}
···········
##代码看起来没有什么问题,可是运行出现了一个小小的问题就是进入到下个界面是闪跳没有停顿,所以我就发现了在跳转首页时候应该加上一个代码
handler.postDelayed(runnable1, 2000);这样界面运行起来就美观合理些##

##其次注册界面,在运行时候出现输入账号密码都出现不能为空现象,原始代码如下:##
·············
import com.avos.avoscloud.AVException;
import com.avos.avoscloud.AVUser;
import com.avos.avoscloud.SignUpCallback; import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast; public class RegistActivity extends Activity {
EditText RegistName;
EditText RegistPwd;
EditText RegistPwd2;
Button Regist;
String RName;
String RPwd;
String RPwd2;
String regist; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_regist);
RegistName = (EditText) findViewById(R.id.RegistName);
RegistPwd = (EditText) findViewById(R.id.RegistPwd);
RegistPwd2 = (EditText) findViewById(R.id.RegistPwd2);
Regist = (Button) findViewById(R.id.Regist); // 修改状态栏颜色,4.4+生效
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
setTranslucentStatus();
}
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.drawable.iphone);//通知栏所需颜色 Regist.setOnClickListener(new OnClickListener() { @Override
public void onClick(View v) {
// TODO Auto-generated method stub RName = RegistName.getText().toString();
RPwd = RegistPwd.getText().toString();
RPwd2 = RegistPwd2.getText().toString(); if (!"".equals(RName) && !"".equals(RPwd) && !"".equals(RPwd2)) { if (!RPwd.equals(RPwd2)) { Toast.makeText(RegistActivity.this, "两次输入的密码不一致", Toast.LENGTH_LONG).show(); } else { AVUser user = new AVUser();// 新建 AVUser 对象实例
user.setUsername(RName);// 设置用户名
user.setPassword(RPwd);// 设置密码
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(AVException e) {
if (e == null) {
// 注册成功
Toast.makeText(RegistActivity.this, "注册成功", Toast.LENGTH_LONG).show();
Handler handler = new Handler();
Runnable runnable = new Runnable() { @Override
public void run() {
// TODO Auto-generated method stub
Intent intent = new Intent(RegistActivity.this, LoginActivity.class);
startActivity(intent);
finish(); }
};
handler.postDelayed(runnable, 2000);
} else {
// 失败的原因可能有多种,常见的是用户名已经存在。
Toast.makeText(RegistActivity.this, "用户名已存在", Toast.LENGTH_LONG).show();
}
}
});
}
} }
}); private void setTranslucentStatus() { Window window = this.getWindow();
// Translucent status bar
window.setFlags(
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
##在运行输入时候总是提示账户密码不能为空,那么,看上面两次密码输入不一致的语句中只有一个IF语句,else语句被遗漏没有其他情况来让程序判定执行,我再在其相对应的语句加上
else
{Toast.makeText(RegistActivity.this, "两次输入的密码一致", Toast.LENGTH_LONG).show();}代码##

##其三在登录出现了同样的错误,所以我又在相对应的地方加上了代码
else
{
Toast.makeText(LoginActivity .this, "两次输入的密码不一致", Toast.LENGTH_LONG).show();
}##

##其次我还发现了一些细节问题,在运行时候相对应的XML文件界面不去显示,例如list_item.xml,list_item1.xml界面,运行时候看不出来相对应的效果。##
维护Study的更多相关文章
- 【线段树维护复杂状态】Ryuji doesn't want to study
https://nanti.jisuanke.com/t/31460 tree[rt].ans = tree[rt << 1].ans + tree[rt << 1 | 1]. ...
- Machine Learning Algorithms Study Notes(2)--Supervised Learning
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- Codeforces 834D The Bakery【dp+线段树维护+lazy】
D. The Bakery time limit per test:2.5 seconds memory limit per test:256 megabytes input:standard inp ...
- 计蒜客 31460 - Ryuji doesn't want to study - [线段树][2018ICPC徐州网络预赛H题]
题目链接:https://nanti.jisuanke.com/t/31460 Ryuji is not a good student, and he doesn't want to study. B ...
- 徐州网络赛H-Ryuji doesn't want to study【线段树】
Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, ea ...
- Gitlab 社区版安装部署和维护指南
因为我的个人网站 restran.net 已经启用,博客园的内容已经不再更新.这篇文章是在 Gitlab 7.4 的环境下配置的,相关内容可能已经过时. 后续做了一次迁移,将 Gitlab 升级到了 ...
- Ryuji doesn't want to study 2018徐州icpc网络赛 树状数组
Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, ea ...
- ACM-ICPC 2018 徐州赛区网络预赛 H. Ryuji doesn't want to study (线段树)
Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, ea ...
- 【ASE模型组】Hint::neural 模型与case study
模型 基于搜索的提示系统 我们的系统用Pycee针对语法错误给出提示.然而,对于语法正确.结果错误的代码,我们需要另外的解决方式.因此,我们维护一些 (错误代码, 相应提示) 的数据,该数据可以由我们 ...
随机推荐
- java泛型简单学习
一. 泛型概念的提出(为什么需要泛型)? 首先,我们看下下面这段简短的代码: //import java.util.List; public class GenericTest { public st ...
- matlab 全局变量的使用举例
昨天在写项目时,想要把获取到的临时变量放入一个全局变量,为以后的使用做准备,结果总是出错,今天做了一个小程序,放在这里备用. 自定义函数: global_p.m function y=global_p ...
- IIS7.0发布后关于"不能在此路径中使用此配置节”的解决办法
在系统为window sever2008,iis7.0上安装后发布出现 IIS Web Core 通知 BeginRequest 处理程序 尚未确定 错误代码 0x80070021 配置错误 不能在此 ...
- 矩阵求逆的几种方法总结(C++)
矩阵求逆运算有多种算法: 伴随矩阵的思想,分别算出其伴随矩阵和行列式,再算出逆矩阵: LU分解法(若选主元即为LUP分解法: Ax = b ==> PAx = Pb ==>LUx = Pb ...
- [Kafka] - Kafka内核理解:Message
一个Kafka的Message由一个固定长度的header和一个变长的消息体body组成 header部分由一个字节的magic(文件格式)和四个字节的CRC32(用于判断body消息体是否正常)构成 ...
- BZOJ 1103: [POI2007]大都市meg(dfs序,树状数组)
本来还想链剖的,结果才发现能直接树状数组的= = 记录遍历到达点与退出点的时间,然后一开始每个到达时间+1,退出时间-1,置为公路就-1,+1,询问直接点1到该点到达时间求和就行了- - CODE: ...
- Mac环境下.Net开发
Mono是一个由Novell公司(由Xamarin发起),并由Miguel de lcaza领导的,一个致力于开创.NET在Linux上使用的开源工程.它包含了一个C#语言的编译器,一个CLR的运行时 ...
- Redis 安装与初体验
一.Redis简介 Redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset(s ...
- smarty模板基础1
smarty模板的作用可以让前端和后端分离(也就是前端的显示页面和后端的php代码). smarty模板的核心是一个类,下载好的模板中有这么几个重要的文件夹 (1)libs核心文件夹(2)int.in ...
- Python编程快速上手——让繁琐工作自动化学习笔记
第一部分 基本语法 1.字符串不能直接和数字相加,要用str()转一下:但是可以和数字相乘,用于表示多个字符串复制:字符串不能和浮点数直接结合,字符串可以和字符串直接相加: 2.输入函数用input( ...