(1) The functions of the management system are mainly: Students, teachers registration login, and elective courses, as well as modify students ' performance and other basic simple functions, the most important thing is to achieve some dialog use.
The interface is as follows:
(2) The main code is as follows: (personal leave notes, such as the need for complete code, at the bottom of the free download)
Below is an adapter that sets the value for a Listvie, where a itemview is loaded, and an inherited method is used in the adapter to notify the adapter to update.
Public class courseadapter extends baseadapter { PrivateContext context;PrivateList<course> coursetlist; Public Courseadapter(context context, list<course> coursetlist) { This. Context = Context; This. coursetlist = coursetlist; } Public int GetCount() {returnCoursetlist.size (); } PublicObjectGetItem(intPosition) {returnCoursetlist.get (position); } Public Long Getitemid(intPosition) {returnPosition }/** * Notify adapter Update data */ @Override Public void notifydatasetchanged() {Super. notifydatasetchanged (); } PublicViewGetView(intPosition, View Convertview, ViewGroup parent) {if(Convertview = =NULL) {//The layout file for each item entry loaded hereConvertview = 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);//Get a student of a locationCourse Course = coursetlist.get (position); Tv_name.settext (Course.getstudentname () +""); Tv_course.settext (Course.getcoursename () +""); Tv_score.settext (Course.getcoursesocre () +"");returnConvertview; }}
(3) also uses the Java reflection mechanism, unifies the Factory mode to operate:
Public class personfactory { /** * Produce objects according to the name of the class: the reflection mechanism of Java uses * * @param className * @return */ PublicPersoninterGetpersonbyclass(String className) {Try{Personinter Personinter = (personinter) class.forname (className). newinstance ();returnPersoninter; }Catch(Instantiationexception e) {E.printstacktrace (); }Catch(Illegalaccessexception e) {E.printstacktrace (); }Catch(ClassNotFoundException e) {E.printstacktrace (); }return NULL; }/** * Create objects by type * / PublicPersoninterGethair(String key) {if("Student". Equals (key)) {return NewStudentimpl (); }Else if("Teacher". Equals (key)) {return NewTeacherimpl (); }return NULL; }/** * Produce objects according to the name of the class: Map of Java */ PublicPersoninterGetpersonbyclasskey(String key) {Try{map<string, string> Map =NewPropertiesreader (). GetProperties (); Personinter person = (personinter) class.forname (Map.get (Key)). Newinstance ();returnPerson }Catch(Instantiationexception e) {E.printstacktrace (); }Catch(Illegalaccessexception e) {E.printstacktrace (); }Catch(ClassNotFoundException e) {E.printstacktrace (); }return NULL; }}
Project Source: Http://yunpan.cn/cVHSjNCeRxZqV access Password 96DD
Android Simple Student management system