最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

簡(jiǎn)單實(shí)現(xiàn)Android學(xué)生管理系統(tǒng)(附源碼)

 更新時(shí)間:2015年12月11日 14:15:58   作者:徐劉根  
這篇文章主要介紹了如何簡(jiǎn)單實(shí)現(xiàn)Android學(xué)生管理系統(tǒng),特別適合計(jì)算機(jī)專業(yè)的即將畢業(yè)的同學(xué)學(xué)習(xí)借鑒制作學(xué)生管理系統(tǒng),感興趣的小伙伴們可以參考一下

本文實(shí)例講述了Android實(shí)現(xiàn)學(xué)生管理系統(tǒng),分享給大家供大家參考。具體如下:

(1)管理系統(tǒng)實(shí)現(xiàn)的功能主要是:學(xué)生、教師的注冊(cè)登錄,和選課,以及修改學(xué)生的成績(jī)等基本簡(jiǎn)單的功能,最主要的是實(shí)現(xiàn)一些Dialog的使用。
界面如下:

(2)主要代碼如下:(個(gè)人留作筆記,如需要完整代碼,在最下邊免費(fèi)下載)

下邊是一個(gè)適配器,適配器是為了一個(gè)listvie進(jìn)行設(shè)置值,其中加載的是一個(gè)itemview,適配器中還是用了繼承的方法,用于通知適配器進(jìn)行更新。

public class CourseAdapter extends BaseAdapter {

 private Context context;
 private List<Course> coursetList;

 public CourseAdapter(Context context, List<Course> coursetList) {
 this.context = context;
 this.coursetList = coursetList;
 }

 public int getCount() {
 return coursetList.size();
 }

 public Object getItem(int position) {
 return coursetList.get(position);
 }

 public long getItemId(int position) {
 return position;
 }

 /**
 * 通知adapter更新數(shù)據(jù)
 */
 @Override
 public void notifyDataSetChanged() {
 super.notifyDataSetChanged();
 }

 public View getView(int position, View convertView, ViewGroup parent) {

 if (convertView == null) {
 //這里加載的每一個(gè)item條目的布局文件
 convertView = LayoutInflater.from(context).inflate(
 R.layout.student_score_item, null);
 }

 TextView tv_name = (TextView) convertView.findViewById(R.id.tv_name);
 TextView tv_course = (TextView) convertView
 .findViewById(R.id.tv_course);
 TextView tv_score = (TextView) convertView.findViewById(R.id.tv_score);

 // 獲得某一個(gè)位置的student
 Course course = coursetList.get(position);
 tv_name.setText(course.getStudentName() + "");
 tv_course.setText(course.getCourseName() + "");
 tv_score.setText(course.getCourseSocre() + "");

 return convertView;
 }

}

(3)還用到了Java的反射機(jī)制,結(jié)合工廠模式進(jìn)行操作:

public class PersonFactory {

 /**
 * 根據(jù)類的名稱來(lái)生產(chǎn)對(duì)象:java的反射機(jī)制使用
 * 
 * @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;
 }

 /**
 * 根據(jù)類型來(lái)創(chuàng)建對(duì)象
 */
 public PersonInter getHair(String key) {
 if ("student".equals(key)) {
 return new StudentImpl();
 } else if ("teacher".equals(key)) {
 return new TeacherImpl();
 }
 return null;
 }

 /**
 * 根據(jù)類的名稱來(lái)生產(chǎn)對(duì)象: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;
 }
}

源碼下載: Android學(xué)生管理系統(tǒng)

希望本文所述對(duì)大家學(xué)習(xí)Android軟件編程有所幫助。

相關(guān)文章

最新評(píng)論

海晏县| 天台县| 上高县| 栾川县| 大厂| 安阳县| 年辖:市辖区| 平武县| 邛崃市| 商丘市| 资溪县| 乌兰察布市| 弥勒县| 沧源| 五家渠市| 灵石县| 酉阳| 麻栗坡县| 秦皇岛市| 陕西省| 维西| 广安市| 石门县| 定远县| 精河县| 绥宁县| 车致| 枣庄市| 乌兰察布市| 南郑县| 平潭县| 陇西县| 阳春市| 北安市| 乌兰县| 偃师市| 普安县| 同江市| 岱山县| 荆门市| 旺苍县|