Where to put it, how do I develop it from the new project.
1. Create a new project and build your own application
Initialize XUTILS3 and your own Uncaughtexceptionhandler in application, unified Management app exit Add, remove activity stack
Each activity inherits its own activity_base (convenient post-unification processing), each activity adds to the stack (does not inherit, manually adds the stack mainly for the application to exit)
2. Naming method (greatly improve development efficiency) eg:
Activity------>activity_base
Fragment---->fragment_base (type _ function)
Adapter----->adapter_fragment_order (which class of adapter)
Layout------->activity_base (class name lowercase)
3. Annotations Eg:
Layout annotations
@ContentView (R.layout.activity_md_using_surface_view) Public class extends Activity_base
View annotations
// Add plugin
(Tap, hold, etc) event annotations
@Event (r.id.button_add_plugin) privatevoid Add (view view) {l.i ("Click to add");} //Button Add plugin event, click (type can be saved)
@Event (type = View.onlongclicklistener. Class, value=r.id.vr_down)privateboolean vr_down_long (view view) {l.i ("option long Press Down"); Long Press
4. High cohesion, low coupling
4.1. In-app communications can be eventbus instead of handler or broadcast
4.2 Decoupling of logic eg: network requests, requests and parsing, presentation separation (core, code executed sequentially, logical steps implemented)
Public voidGetData () {x.task (). Run (NewRunnable () {@Override Public voidrun () {requestparams params=NewRequestparams ("http://www.baidu.com/login.php");//Interface AddressParams.addbodyparameter ("username", "123"); Params.addbodyparameter ("Password", "123"); Try { FinalString Result=x.http (). Postsync (params, String.class);//Synchronize request in asynchronous task, GET request result str//get JSON, parse it, I encapsulated the FastjsonList<userinfo> list =jsonutil.paraslist (result,userinfo.class); //binding beans to adapter or other ways to update Ui,runonuithread can alsoX.task (). Autopost (NewRunnable () {@Override Public voidrun () {//Text.settext ("Update UI"); } }); }Catch(Throwable e) {e.printstacktrace ();} } }); }
5. The problem of multilayer callback nesting, and the decoupling of asynchronous tasks can be referred to the implementation here
Https://github.com/Aiushtha/Android-LessCallBack
6.
Android Development Considerations