完整版Android学生信息管理系统APP.docx

上传人:b****6 文档编号:16323034 上传时间:2023-07-12 格式:DOCX 页数:58 大小:169.38KB
下载 相关 举报
完整版Android学生信息管理系统APP.docx_第1页
第1页 / 共58页
完整版Android学生信息管理系统APP.docx_第2页
第2页 / 共58页
完整版Android学生信息管理系统APP.docx_第3页
第3页 / 共58页
完整版Android学生信息管理系统APP.docx_第4页
第4页 / 共58页
完整版Android学生信息管理系统APP.docx_第5页
第5页 / 共58页
完整版Android学生信息管理系统APP.docx_第6页
第6页 / 共58页
完整版Android学生信息管理系统APP.docx_第7页
第7页 / 共58页
完整版Android学生信息管理系统APP.docx_第8页
第8页 / 共58页
完整版Android学生信息管理系统APP.docx_第9页
第9页 / 共58页
完整版Android学生信息管理系统APP.docx_第10页
第10页 / 共58页
完整版Android学生信息管理系统APP.docx_第11页
第11页 / 共58页
完整版Android学生信息管理系统APP.docx_第12页
第12页 / 共58页
完整版Android学生信息管理系统APP.docx_第13页
第13页 / 共58页
完整版Android学生信息管理系统APP.docx_第14页
第14页 / 共58页
完整版Android学生信息管理系统APP.docx_第15页
第15页 / 共58页
完整版Android学生信息管理系统APP.docx_第16页
第16页 / 共58页
完整版Android学生信息管理系统APP.docx_第17页
第17页 / 共58页
完整版Android学生信息管理系统APP.docx_第18页
第18页 / 共58页
完整版Android学生信息管理系统APP.docx_第19页
第19页 / 共58页
完整版Android学生信息管理系统APP.docx_第20页
第20页 / 共58页
亲,该文档总共58页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

完整版Android学生信息管理系统APP.docx

《完整版Android学生信息管理系统APP.docx》由会员分享,可在线阅读,更多相关《完整版Android学生信息管理系统APP.docx(58页珍藏版)》请在冰点文库上搜索。

完整版Android学生信息管理系统APP.docx

完整版Android学生信息管理系统APP

 

Android学生信息管理系统APP

 

一、需求剖析

为了方便的进行对学生数据库的操作,本app可在android设施

 

长进行对学生信息数据库的信息管理功能,详细功能以下:

 

1.对数据库中全部学生姓名进行显示,对各个条目进行点击可睁开具

 

体信息

 

2.查问数据:

查问数据是依据姓名与学号两个条件进行查问,二者满

 

足任一条件则进行模糊查问,两个条件同时知足则进行精准查问,查

 

询结果界面与功能一中相同,以姓名摆列,点击睁开全部信息

 

3.增加数据:

在数据库中增加条目,包含姓名(字符串),学号(数字,主键),性别(单项选择框),年纪(数字),专业(字符串)。

每个条目均有误输入设定,且主键可检查重复性,全部数据可检查完好性,若插入成功则会显示一条信息提示成功,若失败则会提示检查主键重复或许数据不完好

 

4.改正数据:

依据姓名学号进行精准查找,查找成功后转入改正界面,

 

为了防备漏填与便利改正界面会默认填补以前的数据(除学号),修

 

改完成即可更新,相同会检查数据完好性

 

1

 

5.删除数据:

依据姓名学号进行精准查找,查找成功则会进行删除,

 

并显示一条删除成功的提示,若失败,也会进行提示

 

二、观点构造设计

 

ER图:

 

三、逻辑构造设计

 

学生:

 

姓名(字符串)

 

学号(数字,主码)

 

2

 

性别(单项选择框)

 

年纪(数字)

 

专业(字符串)

 

createtablestudent

nameTEXT,

NOTEXTPrimaryKey,

sexTEXT,

professionTEXT,

ageTEXT

 

四、详细实现

 

1.主界面:

 

3

 

主界面显示全部功能,每个按钮点击后,跳转进入相应功能

 

中心代码:

publicclassMainextendsActivity{

 

SQLiteDatabasedb;

 

Buttonbtn_search;

Buttonbtn_modify;

Buttonbtn_add;

Buttonbtn_delete;

Buttonbtn_quit;

Buttonbtn_show;

 

@Override

protectedvoidonCreate(BundlesavedInstanceState){

requestWindowFeature(Window.FEATURE_NO_TITLE);

 

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

WindowManager.LayoutParams.FLAG_FULLSCREEN);

 

super.onCreate(savedInstanceState);

setContentView(R.layout.layout_main);

//翻开数据库,若不存在,则创立

db=

SQLiteDatabase.

openOrCreateDatabase

(this

.getFilesDir().toString()+

"/S

tudent.db3"

null

);

btn_search

=(Button)findViewById(R.id.

btn_search

);

btn_modify

=(Button)findViewById(R.id.

btn_modify

);

btn_add

=(Button)findViewById(R.id.

btn_add);

btn_delete

=(Button)findViewById(R.id.

btn_delete

);

btn_quit

=(Button)findViewById(R.id.

btn_quit

);

btn_show

=

(Button)findViewById(R.id.

Btn_show

);

 

try

{

Cursorcursor=db.rawQuery("select*fromstudent",null);

cursor.close();

}

 

catch(SQLiteExceptione)

{

 

4

 

db.execSQL("createtablestudent"

+"("

+"nameTEXT,"

+"NOTEXTPrimaryKey,"

+"sexTEXT,"

+"professionTEXT,"

+"ageTEXT"

+")");

}

//显示全部数据按钮的功能实现

btn_show.setOnClickListener(newOnClickListener()

{

 

publicvoidonClick(Viewsource){

//获得指针

Cursorcursor=db.rawQuery("select*fromstudent",null);

//判断数据库能否不存在任何数据

if(cursor.moveToFirst()==false)

{

Toast.makeText(Main.this,"不存在记录",

Toast.LENGTH_SHORT).show();

}

else

{

Listp=newArrayList();

Listre_name=newArrayList();

Listinfo=newArrayList();

 

//保留搜寻出的全部数据

for(cursor.moveToFirst();!

cursor.isAfterLast();

cursor.moveToNext())

{

int

nameColume=cursor.getColumnIndex(

"name");

int

NOColume=cursor.getColumnIndex(

"NO");

int

proColume=

cursor.getColumnIndex(

"profession"

);

int

sexColume=cursor.getColumnIndex(

"sex"

);

int

ageColume=cursor.getColumnIndex(

"age"

);

Studentstudent=

newStudent();

student.

name

="姓

名:

"+cursor.getString(nameColume);

student.

NO=

"学号:

"

+cursor.getString(NOColume);

student.

sex="性别:

"

+cursor.getString(sexColume);

 

5

 

student.profession="专

业:

"+cursor.getString(proColume);

student.age="年纪:

"+cursor.getString(ageColume);

p.add(student);

String[]temp=student.MakeString();

info.add(temp);

 

Stringnewname=cursor.getString(nameColume);

 

re_name.add(newname);

}

//对保留的数据进行封装

String[]Cur_name=newString[re_name.size()];

Cur_name=re_name.toArray(Cur_name);

String[][]Cur_info=newString[info.size()][];

Cur_info=info.toArray(Cur_info);

 

Bundlebundle=newBundle();

bundle.putStringArray("name",Cur_name);

Studentdata=newStudent();

data.info=Cur_info;

//将封装的数据传达给结果界面的activity

Intentintent=new

Intent(Main.this,SearchResult.class);

intent.putExtras(bundle);

intent.putExtra("data",data);

startActivity(intent);

cursor.close();

}

}

 

});

 

//为剩下的按钮绑定监听器实现跳转功能

btn_search.setOnClickListener(newOnClickListener()

{

 

publicvoidonClick(Viewsource){

Intentintent=newIntent(Main.this,Search.class);

startActivity(intent);

}

 

});

 

6

 

btn_modify.setOnClickListener(newOnClickListener()

{

 

publicvoidonClick(Viewsource){

Intentintent=newIntent(Main.this,Modify.class);

startActivity(intent);

}

 

});

 

btn_add.setOnClickListener(newOnClickListener()

{

 

publicvoidonClick(Viewsource){

Intentintent=newIntent(Main.this,Add.class);

startActivity(intent);

}

 

});

 

btn_delete.setOnClickListener(newOnClickListener()

{

 

publicvoidonClick(Viewsource){

Intentintent=newIntent(Main.this,Delete.class);

startActivity(intent);

}

 

});

 

btn_quit.setOnClickListener(newOnClickListener()

{

 

publicvoidonClick(Viewsource){

db.close();

finish();

}

 

});

}

 

}

 

2.数据显示界面:

 

7

 

按姓名摆列,点击条目睁开详细信息

 

中心代码:

publicclassSearchResultextendsActivity

{

@SuppressLint("RtlHardcoded")

publicvoidonCreate(BundlesavedInstanceState)

{

requestWindowFeature(Window.FEATURE_NO_TITLE);

 

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

WindowManager.LayoutParams.FLAG_FULLSCREEN);

//获得传递来的数据

super.onCreate(savedInstanceState);

setContentView(R.layout.layout_result);

finalIntentintent=getIntent();

 

BaseExpandableListAdapteradapter=new

BaseExpandableListAdapter()

{

 

8

 

//提取数据

Bundlebundle=intent.getExtras();

Studentmem_data=(Student)

getIntent().getExtras().get("data");

String[]people=(String[])bundle.getSerializable("name");

String[][]data=mem_data.info;

 

publicObjectgetChild(intgroupPosition,intchildPosition)

{

returndata[groupPosition][childPosition];

}

 

publiclonggetChildId(intgroupPosition,intchildPosition)

{

returnchildPosition;

}

 

publicintgetChildrenCount(intgroupPosition)

{

returndata[groupPosition].length;

}

//设定每个子选项每行的显示方式

privateTextViewgetTextView()

{

AbsListView.LayoutParamslp=new

AbsListView.LayoutParams(

ViewGroup.LayoutParams.MATCH_PARENT,

ViewGroup.LayoutParams.MATCH_PARENT);

TextViewtextView=newTextView(SearchResult.this);

textView.setLayoutParams(lp);

textView.setGravity(Gravity.CENTER_VERTICAL|

Gravity.LEFT);

textView.setPadding(36,0,0,0);

textView.setTextSize(20);

returntextView;

}

//设定每个子选项显示内容

publicViewgetChildView(intgroupPosition,int

childPosition,booleanisLastChild,ViewconvertView,ViewGroupParent)

{

TextViewtextView=getTextView();

textView.setText("

"+getChild(groupPosition,childPosition).toString());returntextView;

 

9

 

}

 

publicObjectgetGroup(intgroupPosition)

{

returnpeople[groupPosition];

}

 

publicintgetGroupCount()

{

returnpeople.length;

}

 

publiclonggetGroupId(intgroupPosition)

{

returngroupPosition;

}

//设定每个组选项显示内容

publicViewgetGroupView(intgroupPosition,boolean

isExpanded,ViewconvertView,ViewGroupparnet)

{

LinearLayoutll=newLinearLayout(SearchResult.this);

ll.setOrientation(0);

TextViewtextView=getTextView();

textView.setText("

"+getGroup(groupPosition).toString());ll.addView(textView);

returnll;

}

};

 

ExpandableListViewexpandListView=(ExpandableListView)

findViewById(R.id.list);

expandListView.setAdapter(adapter);

}

}

 

10

 

3.增加数据界面:

 

依据文本框输入内容进行数据的插入,且拥有完好性和重复性的判断,插入成功失败均会产

 

生提示

 

中心代码:

publicclassAddextendsActivity{

 

SQLiteDatabasedb;

 

Buttonbtn_Accept;

Buttonbtn_Cancle;

 

TextViewET_name;

TextViewET_NO;

TextViewET_Pro;

TextViewET_Age;

 

11

 

RadioGrouprg;

Stringradio_sex="男";

 

@Override

protectedvoidonCreate(BundlesavedInstanceState){

requestWindowFeature(Window.FEATURE_NO_TITLE);

 

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

WindowManager.LayoutParams.FLAG_FULLSCREEN);

 

super.onCreate(savedInstanceState);

setContentView(R.layout.layout_add);

 

db=

SQLiteDatabase.openDatabase(this.getFilesDir().toString()+

b3",null,SQLiteDatabase.OPEN_READWRITE);

 

btn_Accept=(Button)findViewById(R.id.btn_Accept);

btn_Cancle=(Button)findViewById(R.id.btn_Cancle);

 

ET_name=(TextView)findViewById(R.id.ET_Add_name);

ET_NO=(TextView)findViewById(R.id.ET_Add_NO);

ET_Pro=(TextView)findViewById(R.id.ET_Add_Pro);

ET_Age=(TextView)findViewById(R.id.ET_Add_Age);

 

rg=(RadioGroup)findViewById(R.id.rg);

 

rg.setOnCheckedChangeListener(newOnCheckedChangeListener(){

publicvoidonCheckedChanged(RadioGroupgroup,int

CheckedId){

 

radio_sex=CheckedId==R.id.rad_male?

"男":

"女";

}

});

 

//提交操作

btn_Accept.setOnClickListener(newOnClickListener()

{

publicvoidonClick(Viewsource){

 

Stringname=ET_name.getText().toString();

StringNO=ET_NO.getText().toString();

Stringsex=radio_sex;

Stringpro=ET_Pro.getText().toString();

 

12

 

Stringage=ET_Age.getText().toString();

//规范性与完好性判断

try

{

//插入数据

db.execSQL("insertintostudent

values(?

?

?

?

?

)",newString[]{name,NO,sex,pro,age});

}

//规范性与完好性判断

catch(SQLiteExceptione)

{

Toast.makeText(Add.this,"插入数据失败,请检查数据规范性

与学号的独一性",Toast.LENGTH_SHORT).show();

return;

}

 

Toast.makeText(Add.this,"成功插入一条数

据:

"+"\n"+name+"\n"+NO+"\n"+sex+"\n"+pro+"\n"+age,Toast.LENGTH_SHORT).show();

}

 

});

 

btn_Cancle.setOnClickListener(newOnClickListener()

{

 

publicvoidonClick(Viewsource){

db.close();

finish();

}

 

});

 

}

 

}

 

4.改正数据界面:

 

13

 

查找界面:

 

对文本框内输入的数据进行精准查找,成功后转入改正界面

 

改正界面:

 

14

 

文本框内默认显示以前的数据,改正达成点击确立以文本框内的信息对数据进行更新

 

中心代码:

 

查找:

btn_Accept.setOnClickListener(

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工作范文 > 行政公文

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2