最后,面试前该准备哪些资源复习?
其实客户端开发的知识点就那么多,面试问来问去还是那么点东西。所以面试没有其他的诀窍,只看你对这些知识点准备的充分程度。so,出去面试时先看看自己复习到了哪个阶段就好。
这里再分享一下我面试期间的复习路线:(以下体系的复习资料是我从各路大佬收集整理好的)
《Android开发七大模块核心知识笔记》
《960全网最全Android开发笔记》
《379页Android开发面试宝典》
历时半年,我们整理了这份市面上最全面的安卓面试题解析大全
包含了腾讯、百度、小米、阿里、乐视、美团、58、猎豹、360、新浪、搜狐等一线互联网公司面试被问到的题目。熟悉本文中列出的知识点会大大增加通过前两轮技术面试的几率。
《507页Android开发相关源码解析》
只要是程序员,不管是Java还是Android,如果不去阅读源码,只看API文档,那就只是停留于皮毛,这对我们知识体系的建立和完备以及实战技术的提升都是不利的。
真正最能锻炼能力的便是直接去阅读源码,不仅限于阅读各大系统源码,还包括各种优秀的开源库。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
前言
这篇文章主要是实现上示功能。
首先创建数据库(只能创建一次)
然后输入用户名密码,店家注册,将数据插入数据库
点击记住密码能够在下次登录时自动输入用户名密码
最后点击登录能够进入登录界面。
ps:这里有个bug就是得注册两次才能生效,不太理解哪里有问题了,以后知道了再来补…
问题找到了
没关数据库,所以会有点bug:
cursor.close();
database.close();
及时关闭,就可以解决bug了。
主要文件目录
首先我们看看布局文件:
activity_main.xml
就是一个简单的登录界面的布局。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout\_width="match\_parent"
android:layout\_height="match\_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout\_width="wrap\_content"
android:layout\_height="wrap\_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textView"
android:layout\_width="wrap\_content"
android:layout\_height="wrap\_content"
android:layout\_weight="1"
android:text="用户名:"
android:textSize="20sp"
/>
<EditText
android:id="@+id/uname"
android:layout\_width="281dp"
android:layout\_height="wrap\_content"
android:ems="10"
android:inputType="textPersonName" />
</LinearLayout>
<LinearLayout
android:layout\_width="wrap\_content"
android:layout\_height="wrap\_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textView2"
android:layout\_width="wrap\_content"
android:layout\_height="wrap\_content"
android:layout\_weight="1"
android:text="密 码:"
android:textSize="20sp"
/>
<EditText
android:id="@+id/upwd"
android:layout\_width="281dp"
android:layout\_height="wrap\_content"
android:ems="10"
android:inputType="textPersonName" />
</LinearLayout>
<CheckBox
android:id="@+id/cb"
android:layout\_width="match\_parent"
android:layout\_height="wrap\_content"
android:text="记住密码" />
<Button
android:id="@+id/createdb"
android:layout\_width="match\_parent"
android:layout\_height="wrap\_content"
android:text="创建数据库"/>
<Button
android:id="@+id/register"
android:layout\_width="match\_parent"
android:layout\_height="wrap\_content"
android:text="注册" />
<Button
android:id="@+id/login"
android:layout\_width="match\_parent"
android:layout\_height="wrap\_content"
android:text="登录" />
</LinearLayout>
main.xml
就是一个简单的登录成功界面的布局
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout\_width="match\_parent"
android:layout\_height="match\_parent">
<TextView
android:id="@+id/textView3"
android:layout\_width="wrap\_content"
android:layout\_height="wrap\_content"
android:text="欢迎光临!"
android:textSize="50sp"
tools:layout\_editor\_absoluteX="131dp"
tools:layout\_editor\_absoluteY="62dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
MainActivity
内容结构应该比较清晰,按钮绑定各自对应的事件。
稍微解释一下部分代码:
Cursor cursor = database.rawQuery(
"select \* from userTb where uname = ?", new String[]{userName});
表明查询语句,查询到的内容在cursor中,其中?的位置用userName这个字符串来表示,简单来说就是让sql语句写起来方便一点的写法。
String String\_upwd = cursor.getString(cursor.getColumnIndex("upwd"));
表明获取查询内容中的upwd字段的内容。
package icy.hunter;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.widget.ViewPager2;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity{
private CheckBox cb;
private EditText uname;
private EditText upwd;
private static final String SP_INFO = "myuser";
private static final String USER_ID = "UserId";
private static final String USERPWD = "UserPwd";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.uname = findViewById(R.id.uname);
this.upwd = findViewById(R.id.upwd);
this.cb = findViewById(R.id.cb);
Button bt_create = findViewById(R.id.createdb);
Button bt_register = findViewById(R.id.register);
Button bt_login = findViewById(R.id.login);
// 记录保存数据情况
checkIfRemember();
// 创建数据库
bt_create.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase("data/data/icy.hunter/user.db", null);
String sql = "create table userTb(uid integer primary key autoincrement, uname text, upwd text)";
db.execSQL(sql);
Toast.makeText(MainActivity.this, "创建数据库以及表成功!", Toast.LENGTH_LONG).show();
}
});
### 学习分享
在当下这个信息共享的时代,很多资源都可以在网络上找到,只取决于你愿不愿意找或是找的方法对不对了
很多朋友不是没有资料,大多都是有几十上百个G,但是杂乱无章,不知道怎么看从哪看起,甚至是看后就忘
如果大家觉得自己在网上找的资料非常杂乱、不成体系的话,我也分享一套给大家,比较系统,我平常自己也会经常研读。
**2021最新上万页的大厂面试真题**
![](https://img-blog.csdnimg.cn/img_convert/11cdc2e696a61975716a692b091aae90.webp?x-oss-process=image/format,png)
**七大模块学习资料:如NDK模块开发、Android框架体系架构…**
![](https://img-blog.csdnimg.cn/img_convert/b156d4437ec8cf6073d649ec0b325c68.webp?x-oss-process=image/format,png)
只有系统,有方向的学习,才能在段时间内迅速提高自己的技术。
> 这份体系学习笔记,适应人群:
> **第一,**学习知识比较碎片化,没有合理的学习路线与进阶方向。
> **第二,**开发几年,不知道如何进阶更进一步,比较迷茫。
> **第三,**到了合适的年纪,后续不知道该如何发展,转型管理,还是加强技术研究。
### 由于文章内容比较多,篇幅不允许,部分未展示内容以截图方式展示 。
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**[需要这份系统化学习资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618156601)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**
的年纪,后续不知道该如何发展,转型管理,还是加强技术研究。
### 由于文章内容比较多,篇幅不允许,部分未展示内容以截图方式展示 。
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**[需要这份系统化学习资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618156601)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**