Afinal This super-powerful framework that meets the following features and basically covers the core of the mobile app
Database (a few words will be able to make additions and deletions to change)
Annotations (omit FindByID and Setonclicklistener)
Network communication (GET request/POST request/File upload/File download)
Picture Capture (a word resolved)
Here is an example of implementation, and put the code on the server:
public class Mainact extends Finalactivity {@ViewInject (id = r.id.abt, click = "Dbclick")//Implement note button Abbutton; @ViewInjec T (id = R.ID.GETBT, click = "Getclick") button Getbutton; @ViewInject (id = r.id.postbt, click = "Postclick") button Postbutton ; @ViewInject (id = r.id.tv) TextView TextView; @ViewInject (id = r.id.filebt, click = "Fileclick") Button filebutton;@ Viewinject (id = r.id.filebt2, click = "FileClick2") Button FileButton2; @ViewInject (id = r.id.picbt, click = "Picclick") but ton Picbutton; @ViewInject (id = r.id.img) ImageView ImageView; @Overrideprotected void OnCreate (Bundle Savedinstancestate) {//TODO auto-generated method Stubsuper.oncreate (savedinstancestate); Setcontentview ( R.layout.afinallay);} public void Picclick (View v) {toast.maketext (Getapplicationcontext (), "in", "a"). Show (); Finalbitmap Finalbitmap = Finalbitmap.create (this); Finalbitmap.display (ImageView, "http://e.hiphotos.baidu.com/ Image/pic/item/b999a9014c086e06d1925b1300087bf40ad1cbb4.jpg ");} public void FileClick2 (View v) {//textDownload Finalhttp finalhttp = new Finalhttp (); Ajaxparams ajaxparams = new Ajaxparams (); try {httphandler<file> handler = finalhttp.download ("http:// 192.168.191.1:8080/androidtest/a.doc ", environment.getexternalstoragedirectory () +"/im.doc ", True,new AjaxCallBack <File> () {@Overridepublic void onsuccess (file t) {//TODO auto-generated method Stubtextview.settext ("File Down Suc Cess ");}}); catch (Exception e) {//TODO auto-generated catch Blocke.printstacktrace ();}} public void Fileclick (View v) {//File upload finalhttp finalhttp = new Finalhttp (); Ajaxparams ajaxparams = new Ajaxparams (); try {ajaxparams.put ("file", new file (environment.getexternalstoragedirectory () + "/n.jpg"); Finalhttp.post ("Http://192.168.191.1:8080/androidtest/test3", Ajaxparams, New ajaxcallback< Object> () {@Overridepublic void onsuccess (Object t) {//TODO auto-generated method Stubtextview.settext ((t = = null)? " Null ": (String) t);}});} catch (FileNotFoundException e) {//TODO auto-generated catch Blocke.printstacktRace ();}} public void Getclick (View v) {//get request finalhttp finalhttp = new Finalhttp (); Ajaxparams params = new Ajaxparams ();p arams.put ("id", "1");p arams.put ("name", "Duerget");p arams.put ("Age", "521"); Finalhttp.get ("Http://192.168.191.1:8080/androidtest/test2", Params,new ajaxcallback<object> () {@ overridepublic void onsuccess (Object t) {//TODO auto-generated method stubif (TextView = null) Toast.maketext (Getapplica Tioncontext (), "(Textview==null)", "()." Show (); Elsetextview.settext ((t = = null)? "Null": (String) t);}}); public void Postclick (View v) {//post request finalhttp finalhttp = new Finalhttp (); Ajaxparams params = new Ajaxparams ();p arams.put ("name", "Duerpost");p arams.put ("Pass", ""); Finalhttp.post ("http:/ /192.168.191.1:8080/androidtest/test2 ", Params,new ajaxcallback<object> () {@Overridepublic void onsuccess ( Object t) {//TODO auto-generated method Stubtextview.settext ((t = = null)? "Null": (String) t);}}); public void Dbclick (View v) {//CREATE database before Bean @table (name= "TableName") implements the custom table name Toast.maketext (Getapplicationcontext (), "in", "."). Show (); Finaldb finaldb = Finaldb.create (This, "UserDB"); UserBean bean1 = new UserBean () bean1.setage ("n"); Bean1.setname ("Duzi"); Finaldb.save (BEAN1); UserBean bean2 = new UserBean () bean2.setage ("n"); Bean2.setname ("Duzi"); Finaldb.save (bean2);}}
Server upload receive code:
public class FileUpload extends HttpServlet {@Overrideprotected void DoPost (HttpServletRequest request, HttpServletResponse response) throws Servletexception, IOException {//TODO auto-generated method Stubboolean isupload = S Ervletfileupload.ismultipartcontent (Request), if (isupload) {Diskfileitemfactory factory = new Diskfileitemfactory (); Factory.setsizethreshold (factory.setrepository) (New File ("E:\\upload")); Servletfileupload upload = new Servletfileupload (factory); Upload.setsizemax (10); Servletfileupload SFU = new Servletfileupload (factory); try {list<fileitem> diskfileitems = sfu.parserequest ( Request), for (Fileitem item:diskfileitems) {System.out.println ("-------------key:" + item.getfieldname ()); System.out.println (Item.getname ()); File Myfile=new file ("e:\\upload\\" +item.getname ()); try {item.write (myFile);} catch (Exception E) {//TODO Auto-generated catch Blocke.printstacktrace ();} System.out.println ("-------------value:" +//item.getstring ());//System.out.println ("-------------Inputsream: "+//item.getinputstream ());}} catch (Fileuploadexception e) {e.printstacktrace ();}} Response.getwriter (). Print ("okok!");}}
"Android Combat" afinal framework of Use Daquan case