(1)管理系统实现的功能主要是:学生、教师的注册登录,和选课,以及修改学生的成绩等基本简单的功能,最主要的是实现一些Dialog的使用,
Android简单的学生管理系统
。界面如下:
(2)主要代码如下:(个人留作笔记,如需要完整代码,在最下边免费下载)
下边是一个适配器,适配器是为了一个listvie进行设置值,其中加载的是一个itemview,适配器中还是用了继承的方法,用于通知适配器进行更新。<喎?http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4NCjxwcmUgY2xhc3M9"brush:java;">public class CourseAdapter extends BaseAdapter { private Context context; private List
(3)还用到了Java的反射机制,结合工厂模式进行操作:
<code class="hljs" java="">public class PersonFactory { /** * 根据类的名称来生产对象:java的反射机制使用 * * @param className * @return */ public PersonInter getPersonByClass(String className) { try { PersonInter personInter = (PersonInter) Class.forName(className).newInstance(); return personInter; } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; } /** * 根据类型来创建对象 */ public PersonInter getHair(String key) { if (student.equals(key)) { return new StudentImpl(); } else if (teacher.equals(key)) { return new TeacherImpl(); } return null; } /** * 根据类的名称来生产对象:java的映射 */ public PersonInter getPersonByClassKey(String key) { try { Map<string, string="">map = new PropertiesReader().getProperties(); PersonInter person = (PersonInter) Class.forName(map.get(key)).newInstance(); return person; } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; }}</string,></code>