国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

簡單實現Android學生管理系統(附源碼)

2020-04-11 11:12:21
字體:
來源:轉載
供稿:網友

本文實例講述了Android實現學生管理系統,分享給大家供大家參考。具體如下:

(1)管理系統實現的功能主要是:學生、教師的注冊登錄,和選課,以及修改學生的成績等基本簡單的功能,最主要的是實現一些Dialog的使用。
界面如下:

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

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

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更新數據 */ @Override public void notifyDataSetChanged() { super.notifyDataSetChanged(); } public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { //這里加載的每一個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); // 獲得某一個位置的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的反射機制,結合工廠模式進行操作:

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; }}

源碼下載: Android學生管理系統

希望本文所述對大家學習Android軟件編程有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 清徐县| 新干县| 庆阳市| 勃利县| 桓仁| 神木县| 石屏县| 高青县| 大同市| 沾化县| 宽城| 古田县| 蓬溪县| 西平县| 琼结县| 略阳县| 当雄县| 昭通市| 南木林县| 正宁县| 宾川县| 南丹县| 舞钢市| 荔浦县| 资溪县| 宝应县| 托克逊县| 安宁市| 温宿县| 安化县| 丰宁| 常熟市| 唐山市| 衡阳县| 车致| 进贤县| 大石桥市| 汾西县| 伊宁县| 长沙县| 肇源县|