What is Beeframework?
Beeframework Android provides an app DEMO based on the MVC development model for Android Junior developers and provides an in-app debugging tool, including
View Network data Request History
Crash Log List
Simulated 2G\3G network in real-computer WiFi environment
View app performance (memory footprint, CPU usage, etc.)
Quick Start What is MVC
MVC is a software architecture model that divides a system into models, views, and controllers. By simplifying the complexity of software, MVC is a program that is more intuitive, easy to reuse, expand and maintain. In Android app development, usually the controller is activity, control interface jump, processing request, refresh interface. The view corresponds to the various layout of the Android system, enabling the interface to be drawn. Model is used to initiate an HTTP request to store local data.
Turn on debug mode
Requires application to inherit from Beeframeworkapp, which is called when mainactivity presses the return key
Beeframeworkapp.getinstance (). Showbug (this);
650) this.width=650; "Src=" https://raw.githubusercontent.com/BeeFramework/BeeFramework_Android/master/ Example.png "alt=" image "style=" border:0px; "/>
Network data requests
The network library uses Android Query and does further encapsulation.
(1) Create a Datamodel class.
public class Shotmodel extends basemodel{public Shotmodel (context context) {super (context); }}
(2) Create a new model in the activity.
Shotmodel = new Shotmodel (this), Shotmodel.addresponselistener (this);
(3) Create a network request method in Datamodel
public void getdata () { string url = apiinterface.shot_ list; beecallback<jsonobject> cb = new beecallback< Jsonobject> () { @Override public void callback (string url, jsonobject jo, ajaxstatus Status) { shotmodel.this.onmessageresponse (Url, jo, status); } }; cb.url (URL). Type (JSONObject.class). method (Constants.method_get); aq.ajax (CB); }
(4) The implementation of the Businessresponse method in the activity, after the successful network request, the method will be called, this processing interface refresh and other operations
public void onmessageresponse (String url, jsonobject jo, ajaxstatus status) throws Jsonexception {}
About data storage
Any object that implements inheritance from model can be stored. For example: public class COMMENT extends Model {} storage: COMMENT COMMENT = new COMMENT (); Comment.save () read: Comment comment = new Select (). from (Comment.class). WHERE ("comment_id =?", 1). ("comment_id ASC "). Executesingle ();
Open Crash Log
String path = Environment.getexternalstoragedirectory (). GetAbsolutePath () + Appconst.log_dir_path; File Storepath = new file (path); Storepath.mkdirs (); Thread.setdefaultuncaughtexceptionhandler (New CustomExceptionHandler (path, null));
Analog 2G/3G Network
Beequery.setforcethrottlebandwidth (TRUE); Beequery.setmaxbandwidthpersecond (1000);//Limited 1000BYTES/S
This article is from the "unity of Knowledge" blog, please be sure to keep this source http://poarry.blog.51cto.com/5970996/1566099
Android development Framework and in-app debugging Tools