多媒体技术综合实训
课题名称 多媒体展示系统的设计与开发
计算机与软件学院
计算机多媒体(游戏软件设计与开发)
计媒1021
1002553224
学 号 1002553206 1002553218 院 系 专 业 班 级 1002553212 1002553201 1002553206
罗传龙 尹喜晨 王育 李乐乐 赵妹 范小玉 学生姓名
指导教师: 聂桂军、杨立力
南京工业职业技术学院综合项目实训报告 2012 年 06 月 19 日
第 2 页
南京工业职业技术学院综合项目实训报告
目 录
目 录 ........................................................ 3
前 言 ........................................................ 4
第一章 概要设计 ................................................ 5
1.1 项目研发背景 ............................................ 5
1.2 项目功能简介 ............................................ 5
1.3 实训的操作环境 .......................................... 6
第二章 整体设计 ................................................ 7
2.1 框架设计 ................................................ 7
第三章 详细设计 ............................................. 8
3.1 模块的设计 .............................................. 8
实训心得 ...................................................... 43
参考文献 ...................................................... 44
第 3 页
南京工业职业技术学院综合项目实训报告
前言
随着智能手机一步步走进普通人的生活,它将成为人们获取信息的主要设备。因此,手机的应用服务将会有很大的发展空间,Android手机学生系统管理服务就是其中的一项。目前的学生系统管理服务主要以使用单机或者网页方式实现,这些方式不适合在户外旅游等场合下进行,给用户造成了很多的不便。Android平台提供给普通开发者非常灵活的学生资料展示与控制功能,这将使学生系统管理服务的设计与实现有了更好的平台。另外,Android平台基本上是免费的,所以能够有效降低软件的成本,最终让每个用户能够自由地获取信息,也为手机服务的普及做出贡献。
本次实训对目前应用现状进行了分析与比较,进而研究分析了Android平台的系统架构和组件模型,在此基础上,基于Android平台设计和开发了一个手机学生系统管理服务,本系统界面友好、操作便捷,具有良好的可扩展性和可维护性;系统经过测试,可以稳定运行,能够满足手机用户基本的学生系统管理服务需求。
第 4 页
南京工业职业技术学院综合项目实训报告
第一章 概要设计
1.1 项目研发背景
学生信息档案的管理对于学校的管理者来说至关重要,学生信息是高等学校非常重要的一项数据资源,是一个教育单位不可缺少一部分。特别是近几年来,国家政策的调整,我国高等院校大规模的扩招,给高等院校的教学管理、学生管理、后勤管理等方面都带来不少的冲击。其包含的数据量大,涉及的人员面广,而且需要及时更新,故较为复杂,难以单纯地依赖人工管理,而且传统的人工管理方式既不易于规范化,管理效率也不高,目前我国各类高等院校中还有相当一部分学生档案管理还停留在纸介质的基础上,尤其是中、小学对学生档案的管理更是落后,这样的管理机制已经不能适应时代发展的要求,其管理方法将浪费许多人力和物力。随着科学技术的不断提高,计算机科学与技术日渐成熟,计算机应用的普及已进入人类社会生活的各个领域,并发挥着越来越重要的作用。这种传统的手工管理模式必然被以计算机为物质基础的信息管理方法所取代。
1.2 项目功能简介
学生信息管理系统是针对学校人事处的大量业务处理工作而开发的管理软件,主要用于学校学生信息管理,总体目标是实现学生信息关系的系统化、科学化、规范化和自动化,其主要任务是用计算机对学生各种信息进行日常管理,如查询、修改、增加、删除,另外还考虑到学生选课,针对这些要求设计了学生信息管理系统。推行学校信息管 第 5 页
南京工业职业技术学院综合项目实训报告
理系统的应用是进一步推进学生学籍管理规范化、电子化、控制辍学和提高义务教育水平的重要举措。
1.3 实训的操作环境
操作系统平台:LINUX。
软件:Android,SQLite
第 6 页
第二章 整体设计
2.1 框架设计
南京工业职业技术学院综合项目实训报告
第三章 详细设计
3.1 模块的设计
3.1.1 系统登陆界面
界面文件 main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="/apk/res/android" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bizhi"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="学生管理系统:"
第 8 页
南京工业职业技术学院综合项目实训报告
android:textSize="20dp" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="10dp"
android:src="@drawable/logo" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="17dp"
android:text="登陆人员:" />
<RadioGroup
android:id="@+id/radioGroup1"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" >
<RadioButton
android:id="@+id/radio0"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:checked="true"
android:text="老师" />
<RadioButton
android:id="@+id/radio1"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="40dp"
android:text="学生" />
</RadioGroup>
</LinearLayout>
第 9 页
南京工业职业技术学院综合项目实训报告
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/bt1"
android:layout_width="110dp"
android:layout_height="70dp"
android:layout_marginLeft="100dp"
android:layout_marginTop="20dp"
android:text="确定" />
</LinearLayout>
<Button
android:id="@+id/bt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="200dp"
android:layout_marginTop="60dp"
android:text="新生注册" />
<Button
android:id="@+id/bt4"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_marginLeft="200dp"
android:layout_marginTop="20dp"
android:text="退出" />
</LinearLayout>
登陆界面 Denglu_sr.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp" >
第 10 页
南京工业职业技术学院综合项目实训报告
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp"
android:textSize="20dp"
android:text="账号:" />
</LinearLayout>
<EditText
android:id="@+id/ed_dl_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
dengluActivity.java
package your.teacher.namespace;
import java.util.ArrayList;
import java.util.List;
import your.students.namespace.R;
import your.students.namespace.R.id;
import your.students.namespace.R.layout;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
public class dengluActivity extends Activity { public static String _id;
/** Called when the activity is first created. */ 第 11 页
南京工业职业技术学院综合项目实训报告
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.denglu);
Button bt1=(Button) findViewById(R.id.bt_de_1);
Button bt2=(Button) findViewById(R.id.bt_de_2);
final EditText ed=(EditText) findViewById(R.id.ed_cha);
bt1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
_id=ed.getText().toString();
Intent it=new Intent(dengluActivity.this,stu_info2.class); startActivity(it);
}
});
bt2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(dengluActivity.this,zhuActivity.class); startActivity(it);
finish();
}
});
}
}
第 12 页
南京工业职业技术学院综合项目实训报告
3.1.2 新生注册界面
新生注册列表文件 zhuce.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bizhi"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="新生注册列表"
android:textSize="25dp" />
第 13 页
南京工业职业技术学院综合项目实训报告
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="请输入学号:" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:layout_marginRight="15dp"
android:hint="(注:是自己的学号)" android:ems="10"
android:inputType="number" >
<requestFocus />
</EditText>
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="请输入姓名:" />
<EditText
android:id="@+id/ed_zhuce_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:ems="10" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="请输入密码:" />
<EditText
android:id="@+id/editText2"
android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp"
第 14 页
南京工业职业技术学院综合项目实训报告
android:layout_marginRight="15dp" android:ems="10" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="再次确认密码:" />
<EditText
android:id="@+id/editText3"
android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:ems="10" />
<LinearLayout
android:layout_width="match_parent" android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="家庭住址:" />
<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content" android:layout_height="35dp"
android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent" android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content" android:layout_height="wrap_content" 第 15 页
南京工业职业技术学院综合项目实训报告
android:text="电话" />
<EditText
android:id="@+id/editText5"
android:layout_width="wrap_content" android:layout_height="35dp"
android:layout_weight="1"
android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:ems="10"
android:inputType="phone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="入学分数:" />
<EditText
android:id="@+id/editText6"
android:layout_width="wrap_content" android:layout_height="35dp"
android:layout_weight="1"
android:layout_marginLeft="15dp" android:layout_marginRight="15dp"
android:hint="(注:在250~500之间)" android:ems="10"
android:inputType="number" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/bt_z_1"
android:layout_width="wrap_content" android:layout_height="wrap_content" 第 16 页
南京工业职业技术学院综合项目实训报告
android:layout_marginLeft="60dp" android:layout_marginTop="30dp" android:text="确定" />
<Button
android:id="@+id/bt_z_2"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="70dp" android:layout_marginTop="30dp" android:text="返回" />
</LinearLayout>
</LinearLayout>
zhuceActivity.java
package your.teacher.namespace;
import java.util.ArrayList;
import java.util.List;
import your.students.namespace.OpenHelper; import your.students.namespace.R;
import your.students.namespace.studentsActivity; import your.students.namespace.R.id;
import your.students.namespace.R.layout;
import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase; import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
public class zhuceActivity extends Activity {
第 17 页
南京工业职业技术学院综合项目实训报告
String i1,i2,i3,i4,i5,i6;
int t1,t2,t3,t4;
public OpenHelper helper;
public SQLiteDatabase mdb;
String b[]={"江苏","浙江","甘肃","黑龙江","福建","云南","台湾"};
private List<String> tt=new ArrayList<String>();
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.zhuce);
helper=new OpenHelper(getApplicationContext());
mdb=helper.getWritableDatabase();
final EditText ed1=(EditText) findViewById(R.id.editText1);
final EditText ed2=(EditText) findViewById(R.id.editText2);
final EditText ed3=(EditText) findViewById(R.id.editText3);
final EditText ed4=(EditText) findViewById(R.id.editText5);
final EditText ed5=(EditText) findViewById(R.id.editText6);
final EditText ed6=(EditText) findViewById(R.id.ed_zhuce_name);
final Spinner sp=(Spinner) findViewById(R.id.spinner);
Button bt1=(Button) findViewById(R.id.bt_z_1);
Button bt2=(Button) findViewById(R.id.bt_z_2);
for(int i=0;i<b.length;i++){
tt.add(b[i]);
}
ArrayAdapter c=new ArrayAdapter(zhuceActivity.this, android.R.layout.simple_spinner_item, tt);
c.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sp.setAdapter(c);
sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> adapter, View view,
int position, long id) {
// TODO Auto-generated method stub
String str=(String) sp.getAdapter().getItem((int)id);
}
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
第 18 页
南京工业职业技术学院综合项目实训报告
bt1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
/*if(ed1.getText().toString().length()!=10){Toast.makeText(zhuceActivity.this, "请正确输入学号", Toast.LENGTH_SHORT).show();}
else if (ed2.getText().toString().length()==0){Toast.makeText(zhuceActivity.this, "请输入密码", Toast.LENGTH_SHORT).show();}
else if (ed3.getText().toString().length()==0){Toast.makeText(zhuceActivity.this, "请再次输入密码", Toast.LENGTH_SHORT).show();}
else
if(!ed2.getText().toString().equals(ed3.getText().toString())){Toast.makeText(zhuceActivity.this, "两次输入的密码不一致", Toast.LENGTH_SHORT).show();}
else
if(ed4.getText().toString().length()==0){Toast.makeText(zhuceActivity.this, "请输电话号码", Toast.LENGTH_SHORT).show();}
else
if(ed5.getText().toString().length()==0){Toast.makeText(zhuceActivity.this, "请输分数", Toast.LENGTH_SHORT).show();}
else
if(ed6.getText().toString().length()==0){Toast.makeText(zhuceActivity.this, "请输姓名", Toast.LENGTH_SHORT).show();}
else
if(Integer.parseInt(ed5.getText().toString())<=250||(Integer.parseInt(ed5.getText().toString())>=500)){Toast.makeText(zhuceActivity.this, "请输入真实分数", Toast.LENGTH_SHORT).show();}*/
mdb=helper.getWritableDatabase();
try{
mdb.execSQL("create table stu(id Integer , name char(30), password char(30),photo Integer,point Integer)");
Toast.makeText(getApplicationContext(), "stu表创建成功", Toast.LENGTH_SHORT).show();
}catch (Exception e) {
// TODO: handle exception
Toast.makeText(getApplicationContext(), "stu表已存在", Toast.LENGTH_SHORT).show();
}
i1=ed1.getText().toString();
第 19 页
南京工业职业技术学院综合项目实训报告
i2=ed6.getText().toString();
i3=ed2.getText().toString();
i4=ed4.getText().toString();
i5=ed5.getText().toString();
Log.i("1", ">>>>>>>>>>>>>>>>>");
t1=Integer.valueOf(i1);
t4=Integer.valueOf(i5);
Log.i("2", ">>>>>>>>>>>>>>>>>>>");
mdb.execSQL("insert into stu (id,name,password,photo,point) values(?,?,?,?,?)", new Object[]{
t1,i2,i3,i4,t4
});
Toast.makeText(getApplicationContext(), "插入成功" +">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+
"学号:" +t1+", "+
"姓名:" +i2+", "+
"密码:" +i3+", "+
"电话:" +t3+", "+
"入学分数:"+i4, Toast.LENGTH_LONG).show();
}
});
bt2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(zhuceActivity.this,studentsActivity.class);
startActivity(it);
finish();
}
});
}
}
第 20 页
南京工业职业技术学院综合项目实训报告
3.1.3 教师系统查询
教师系统查询文件 zhu.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/bizhi" >
<Button
android:id="@+id/bt_zhu_1"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="查询学生成绩" />
<Button
第 21 页
南京工业职业技术学院综合项目实训报告
android:id="@+id/bt_zhu_2"
android:layout_width="match_parent" android:layout_height="80dp" android:text="学生照片一览" />
<Button
android:id="@+id/bt_zhu_3"
android:layout_width="match_parent" android:layout_height="80dp" android:text="课程表" />
<Button
android:id="@+id/bt_zhu_4"
android:layout_width="match_parent" android:layout_height="80dp" android:text="学生资料表" />
<Button
android:id="@+id/bt_zhu_5"
android:layout_width="match_parent" android:layout_height="80dp" android:text="返回" />
</LinearLayout>
zhuActivity.java
package your.teacher.namespace;
import java.util.ArrayList;
import java.util.List;
import your.students.namespace.R;
import your.students.namespace.studentsActivity; import your.students.namespace.R.id;
import your.students.namespace.R.layout;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
第 22 页
南京工业职业技术学院综合项目实训报告
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
public class zhuActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.zhu);
Button bt1=(Button) findViewById(R.id.bt_zhu_1);
Button bt2=(Button) findViewById(R.id.bt_zhu_2);
Button bt3=(Button) findViewById(R.id.bt_zhu_3);
Button bt4=(Button) findViewById(R.id.bt_zhu_4);
Button bt5=(Button) findViewById(R.id.bt_zhu_5);
bt1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(zhuActivity.this,dengluActivity.class); startActivity(it);
finish();
}
});
bt2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(zhuActivity.this,photoActivity.class); startActivity(it);
finish();
}
});
bt3.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
第 23 页
南京工业职业技术学院综合项目实训报告
// TODO Auto-generated method stub
Intent it=new Intent(zhuActivity.this,kebiaoActivity.class); startActivity(it);
finish();
}
});
bt4.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i=new Intent();
i.setClass(getApplicationContext(), stu_info.class); startActivity(i);
}
});
bt5.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(zhuActivity.this,studentsActivity.class); startActivity(it);
finish();
}
});
}
}
第 24 页
南京工业职业技术学院综合项目实训报告
学生照片查询文件 photo.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/bizhi">
<TextView
android:id="@+id/tx_ph"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30dp"
android:layout_marginLeft="20dp"
android:text="江户川·柯南" />
<ImageView
android:id="@+id/im_ph"
第 25 页
南京工业职业技术学院综合项目实训报告
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginTop="40dp"
android:layout_marginLeft="60dp"
android:src="@drawable/pt5" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginLeft="200dp"
android:text="下一位同学" />
<Button
android:id="@+id/bt_ph_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="250dp"
android:text="返回" />
</LinearLayout>
photoActivity.java
package your.teacher.namespace;
import java.util.ArrayList;
import java.util.List;
import your.students.namespace.R;
import your.students.namespace.R.drawable;
import your.students.namespace.R.id;
import your.students.namespace.R.layout;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
第 26 页
南京工业职业技术学院综合项目实训报告
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
public class photoActivity extends Activity {
int i=1;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.photo);
Button bt2=(Button) findViewById(R.id.button1);
Button bt1=(Button) findViewById(R.id.bt_ph_2);
bt2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
ImageView im=(ImageView)findViewById(R.id.im_ph); TextView tt=(TextView) findViewById(R.id.tx_ph); if(i==1){
im.setImageResource(R.drawable.ph1);
tt.setText("漩涡·名人");
i++;
}
else if(i==2){
im.setImageResource(R.drawable.pt2);
tt.setText("蒙奇·D·路飞");
i++;
}
else if(i==3){
im.setImageResource(R.drawable.pt3);
tt.setText("黑崎·一护");
i++;
}
else if(i==4){
im.setImageResource(R.drawable.pt4);
tt.setText("奇牙");
i++;
}
else if(i==5){
im.setImageResource(R.drawable.pt5);
tt.setText("江户川·柯南");
i=1;
}
}
第 27 页
南京工业职业技术学院综合项目实训报告
});
bt1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(photoActivity.this,zhuActivity.class); startActivity(it);
finish();
}
});
}
/* public void bt_ph(View view){
ImageView im=(ImageView)this.findViewById(R.id.im_ph); TextView tt=(TextView) findViewById(R.id.tx_ph);
if(i==1){
im.setImageResource(R.drawable.ph1);
tt.setText("漩涡·名人");
i++;
}
else if(i==2){
im.setImageResource(R.drawable.pt2);
tt.setText("蒙奇·D·路飞");
i++;
}
else if(i==3){
im.setImageResource(R.drawable.pt3);
tt.setText("黑崎·一护");
i++;
}
else if(i==4){
im.setImageResource(R.drawable.pt4);
tt.setText("奇牙");
i++;
}
else if(i==5){
im.setImageResource(R.drawable.pt5);
tt.setText("江户川·柯南");
i=1;
}
}*/}
第 28 页
南京工业职业技术学院综合项目实训报告
课表查询文件 kebiao_xs.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/bizhi">
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:src="@drawable/kebiao2" />
<Button
android:id="@+id/bt_xs_kb"
android:layout_width="90dp"
android:layout_height="50dp"
第 29 页
南京工业职业技术学院综合项目实训报告
android:layout_marginLeft="220dp"
android:text="返回" />
</LinearLayout>
Kebiao_xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/bizhi">
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:src="@drawable/kebiao2" />
<ZoomControls
android:id="@+id/zoomControls1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/bt_kb"
android:layout_width="90dp"
android:layout_height="50dp"
android:layout_marginLeft="220dp"
android:text="返回" />
</LinearLayout>
Kebiao_xs.java
package your.students.namespace;
import your.students.namespace.R;
import your.students.namespace.R.id;
import your.students.namespace.R.layout;
import android.app.Activity;
import android.content.Intent;
第 30 页
南京工业职业技术学院综合项目实训报告
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class kebiao_xsActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.kebiao_xs);
Button bt=(Button) findViewById(R.id.bt_xs_kb);
bt.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(kebiao_xsActivity.this,zhu_xueshengActivity.class); startActivity(it);
finish();
}
});
}
}
KebiaoActivity.java
package your.teacher.namespace;
import your.students.namespace.R;
import your.students.namespace.R.id;
import your.students.namespace.R.layout;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ZoomControls;
第 31 页
南京工业职业技术学院综合项目实训报告
public class kebiaoActivity extends Activity {
/** Called when the activity is first created. */
public ZoomControls zl;
static float size;
public ImageView img;
int oldx,oldy,newx,newy;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.kebiao);
size=(float) 1.0;
img=(ImageView)findViewById(R.id.imageView1);
Button bt=(Button) findViewById(R.id.bt_kb);
zl=(ZoomControls)findViewById(R.id.zoomControls1);
bt.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(kebiaoActivity.this,zhuActivity.class); startActivity(it);
finish();
}
});
zl.setOnZoomInClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
size+=0.5;
img.setScaleX(size);
img.setScaleY(size);
}
});
zl.setOnZoomOutClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
size-=.2;
img.setScaleX(size);
第 32 页
南京工业职业技术学院综合项目实训报告
img.setScaleY(size);
}
});
img.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
//
}
});
}
}
// TODO Auto-generated method stub switch(event.getAction()){ case MotionEvent.ACTION_DOWN: // oldx=(int)event.getRawX(); oldy=(int)event.getRawY(); break; case MotionEvent.ACTION_MOVE: v.setX(event.getX()); v.setY(event.getY()); break; case MotionEvent.ACTION_UP: break; } return true; 第 33 页
南京工业职业技术学院综合项目实训报告
学生资料查询 lisview.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
Stu_in.java
package your.teacher.namespace;
import java.util.ArrayList;
第 34 页
南京工业职业技术学院综合项目实训报告
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import your.students.namespace.OpenHelper;
import your.students.namespace.R;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleAdapter;
public class stu_info extends Activity {
public ListView l;
public OpenHelper helper;
public SQLiteDatabase mdb;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listview1);
l=(ListView)findViewById(R.id.listView1);
SimpleAdapter sap=new SimpleAdapter(this, getData(), R.layout.info,
new String[]{"id","name","password","photo","point"},
new
int[]{R.id.textView1,R.id.textView2,R.id.textView3,R.id.textView4,R.id.textView5}); l.setAdapter(sap);
}
private List<? extends Map<String, ?>> getData() {
// TODO Auto-generated method stub
String S_id,S_name,S_password,S_photo,S_point;
List<Map<String, String>> list=new ArrayList<Map<String,String>>();
helper=new OpenHelper(this);
mdb=helper.getReadableDatabase();
//Cursor cur=mydb.rawQuery("select * from stu where id=?",new String[]{chaActivity._id});
Cursor cur=mdb.rawQuery("select * from stu",null);
cur.moveToFirst();
do{
S_id=cur.getString(cur.getColumnIndex("id"));
S_name=cur.getString(cur.getColumnIndex("name"));
S_password=cur.getString(cur.getColumnIndex("password"));
第 35 页
南京工业职业技术学院综合项目实训报告
S_photo=cur.getString(cur.getColumnIndex("photo"));
S_point=cur.getString(cur.getColumnIndex("point"));
Map<String, String> map=new HashMap<String, String>(); map.put("id", S_id);
map.put("name",S_name);
map.put("password", S_password);
map.put("photo", S_photo);
map.put("point", S_point);
list.add(map);
}while(cur.moveToNext());
return list;
}
}
Stu_in2.java
package your.teacher.namespace;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import your.students.namespace.OpenHelper;
import your.students.namespace.R;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleAdapter;
public class stu_info2 extends Activity {
public ListView l;
public OpenHelper helper;
public SQLiteDatabase mdb;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listview1);
l=(ListView)findViewById(R.id.listView1);
SimpleAdapter sap=new SimpleAdapter(this, getData(), R.layout.info, new String[]{"id","name","password","photo","point"}, new
第 36 页
南京工业职业技术学院综合项目实训报告
int[]{R.id.textView1,R.id.textView2,R.id.textView3,R.id.textView4,R.id.textView5}); l.setAdapter(sap);
}
private List<? extends Map<String, ?>> getData() {
// TODO Auto-generated method stub
String S_id,S_name,S_password,S_photo,S_point;
List<Map<String, String>> list=new ArrayList<Map<String,String>>(); helper=new OpenHelper(this);
mdb=helper.getReadableDatabase();
Cursor cur=mdb.rawQuery("select * from stu where String[]{dengluActivity._id});
//Cursor cur=mdb.rawQuery("select * from stu",null);
cur.moveToFirst();
do{
S_id=cur.getString(cur.getColumnIndex("id"));
S_name=cur.getString(cur.getColumnIndex("name"));
S_password=cur.getString(cur.getColumnIndex("password"));
S_photo=cur.getString(cur.getColumnIndex("photo"));
S_point=cur.getString(cur.getColumnIndex("point"));
Map<String, String> map=new HashMap<String, String>();
map.put("id", S_id);
map.put("name",S_name);
map.put("password", S_password);
map.put("photo", S_photo);
map.put("point", S_point);
list.add(map);
}while(cur.moveToNext());
return list;
}
}
第 37 页 id=?",new
南京工业职业技术学院综合项目实训报告
学生管理系统
学生管理系统文件 zhu_xuesheng.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/bizhi" >
<Button
android:id="@+id/bt_zhu_xs_1"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="查询学生成绩" />
第 38 页
南京工业职业技术学院综合项目实训报告
<Button
android:id="@+id/bt_zhu_xs_2"
android:layout_width="match_parent" android:layout_height="80dp"
android:text="课程表" />
<Button
android:id="@+id/bt_zhu_xs_3"
android:layout_width="match_parent" android:layout_height="80dp"
android:text="返回" />
</LinearLayout>
Zhu_xueshengActivity.java
package your.students.namespace;
import java.util.ArrayList;
import java.util.List;
import your.teacher.namespace.dengluActivity; import your.teacher.namespace.kebiaoActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
public class zhu_xueshengActivity extends Activity {
/** Called when the activity is first created. */ @Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
第 39 页
南京工业职业技术学院综合项目实训报告
setContentView(R.layout.zhu_xuesheng);
Button bt1=(Button) findViewById(R.id.bt_zhu_xs_1);
Button bt2=(Button) findViewById(R.id.bt_zhu_xs_2);
Button bt3=(Button) findViewById(R.id.bt_zhu_xs_3);
bt1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(zhu_xueshengActivity.this,chaxunActivity.class); startActivity(it);
finish();
}
});
bt2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(zhu_xueshengActivity.this,kebiao_xsActivity.class); startActivity(it);
finish();
}
});
bt3.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent it=new Intent(zhu_xueshengActivity.this,studentsActivity.class); startActivity(it);
finish();
}
});
}
}
第 40 页
南京工业职业技术学院综合项目实训报告
Denglu.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bizhi"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请输入学号:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/ed_cha"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
第 41 页
南京工业职业技术学院综合项目实训报告
android:inputType="number" >
<requestFocus />
</EditText>
<LinearLayout
android:layout_width="match_parent" android:layout_height="wrap_content" >
<Button
android:id="@+id/bt_de_1"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="确定" />
<Button
android:id="@+id/bt_de_2"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="返回" />
</LinearLayout>
</LinearLayout>
第 42 页
南京工业职业技术学院综合项目实训报告
实训心得
通过这次的实训,学到了很多,因为我们都是第一次接触android,所以老师先给我们讲了一个基本上每个程序语言都要编的,经典的程序,helloworld。通过这个小程序,我们知道了如何去创建一个android的项目,了解了android项目里的每个文件夹和文件的作用。教了一些常用的控件的使用,如:TextView,Button等等。然后老师又教我们如何布局,认识了linearlayout,tablelayout, AbsoluteLayout,
RelativeLayout四种布局,分别为线型布局,表格布局,绝对布局和相对布局,并知道了如何通过这四种布局的相互嵌套来使程序的界面更加的友好,更加的让用户接受。在实训中不断学习不断进步!
在这4周实训里,经过大家的努力,学生管理系统终于做完了,经过这次实习系 统设计,自己总结了这个学生信息管理系统的一些问题,不过收获还是颇为丰富的,再有理论知识上结合实践,使我学到了更多。
首先,更进一步的了解了数据库的基本操作, 在这之前,数据库的学习仅仅刚开了个头,我们只是在了解一些概念性的东西。在做这个系统之前,我连基本的连接数据库,配文件DSN,数据库查询语句等这些东西都不熟练。
现在对于数据库的增删改查操作比较熟练了,对于初学者来说,比较头疼的就是对于单引号的处理。我的建议是如果不理解先把按照课本上正确的语句敲,然后在多次进行数据库的链接,增删改查操作中不断总结规律。 这次设计的学生信息管理系统,全在自己所掌握的知识下,进行编程设计,完全体现了自己在数据库语言和程序设计课程学习状况,充分地为自己以后更深入了数据库语言奠下深厚的基础。
纵观此学生信息管理系统的整体概况,目前,自我认为设计良好,相关功能都能够实现,功能强大,条理清晰,界面可观性比较好。并且特色在于,所设计的表单都在一个表单系统桌面中运行,比较符合系统的观念。
在系统设计的过程中,我从中发现,学习数据库要细心和有耐性,并且要不断地从外界学习更多的技术才能设计出一套完美的系统。
第 43 页
南京工业职业技术学院综合项目实训报告
参考文献
[1]杨丰盛 《Android应用开发揭秘》 机械工业出版社,2010.01
[2]汪永松 《Android开发平台之旅》 机械工业出版社,2010.08
[3]靳岩,姚尚朗 《Google Android开发入门与实战(移动开发系列丛书)》
人民邮电出版社 2009.07
[4]余志龙 《Google Android SDK开发范例大全(第2版)》人民邮电出版社 2010.06
第 44 页