This article describes the implementation of the Android student management system, sharing for everyone to reference. Specifically as follows:
(1) The functions of the management system are as follows: Students, teachers registration, and elective courses, as well as the revision of 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 notes, such as the need for complete code, at the bottom of the free download)
The bottom is an adapter that sets the value for a listvie that is loaded with a itemview, and an inherited method is used in the adapter to notify the adapter to update.
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;
/** * Notify Adapter UPDATE Data * * * @Override public void notifydatasetchanged () {super.notifydatasetchanged (); Public View GetView (int position, View Convertview, ViewGroup parent) {if (Convertview = null) {//Every item item loaded here
Layout file 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);
To obtain a position of student Course Course = coursetlist.get (position);
Tv_name.settext (Course.getstudentname () + "");
Tv_course.settext (Course.getcoursename () + "");
Tv_score.settext (Course.getcoursesocre () + "");
return convertview;
}
}
The
(3) also uses the Java reflection mechanism to operate in conjunction with the factory pattern:
The public class Personfactory {/** * produces objects based on the name of the class: Java reflection mechanism uses * * @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; /** * Create object by Type/public Personinter Gethair (String key) {if (' Student '. Equals (key)) {return new Studentimpl ()
;
else if ("Teacher". Equals (Key)) {return new Teacherimpl ();
return null; /** * produces objects based on the name of the class: Java Mapping/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;
}
}
SOURCE Download: Android Student Management system
I hope this article will help you learn about Android software programming.