Welcome to follow my GitHub and follow my csdn.
I'll introduce some interesting little points about Android. Previous article.
1. Dagger2 Development Sequence
Application, Component, Module
The module first creates an instance of the class that needs to be provided, and then adds the module to the component (Component) and provides the classes that need to be injected, and finally adds the component to the application (application) and provides the interface.
//Module@Module Public class testappmodule { Private FinalContext Mcontext; Public Testappmodule(Context context) {mcontext = Context.getapplicationcontext (); }//Provide class instances @AppScope @Provides PublicContextProvideappcontext() {returnMcontext; }@Provides PublicWeatherapiclientprovideweatherapiclient() {return NewMockweatherapiclient (); }}//Components@AppScope@Component(modules = Testappmodule.class)//Registration module Public interface testappcomponent extends AppComponent { voidInject (mainactivitytest test);}//Application Public class testweatherapplication extends weatherapplication { PrivateTestappcomponent mtestappcomponent;@Override Public void onCreate() {Super. OnCreate (); Mtestappcomponent = Daggertestappcomponent.builder (). Testappmodule (NewTestappmodule ( This). build (); }//Supply Components @Override PublicTestappcomponentgetappcomponent() {returnMtestappcomponent; }}
2. JRebel
Android Debugging tools, without compiling, you can refresh some project modifications. However, the feature has been replaced by Android Studio 2.0, waiting for the 2.0 official release.
3. Data binding (DataBinding)
DataBinding implements the separation of data from the page, more in line with the object-oriented programming model.
Layout settings
< Data><variable name="Weatherdata" Type= "Clwang.chunyu.me.wcl_espresso_dagger_demo." data. weatherdata"/></ Data><TextViewAndroid:id="@+id/temperature"Android:layout_width="Wrap_content"android:layout_height="Wrap_content"Android:layout_centerinparent="true"Android:layout_marginbottom="@dimen/margin_large"android:layout_margintop="@dimen/margin_xlarge"android:text="@{weatherdata.temperaturecelsius}"Android:textappearance="@style/textappearance.appcompat.display3"tools:text="10°"/>
Logical Settings
private// 页面绑定类mBinding = DataBindingUtil.setContentView(this// 绑定页面// 使用Id// 绑定数据
4. Classyshark
The software to view the APK information is very powerful, eliminating the steps to decompile, the main features:
(1) For more information on Dex in Multidex.
(2) Use nativelibrary for more information.
(3) Class details.
(4) Quantity statistics.
5. Cocoapod Installation
Upgrading your Mac system may cause the pod command to disappear and you will need to reinstall the pod.
-n /usr/local/bin cocoapods
6. Launchmode
The Launchmode consists of four modes,
(1) Standard, Normal mode, start re-create example, default.
(2) Singletop, stack top multiplexing mode, located at the top of the stack, boot will not be created, call onnewintent.
(3) Singletask, stack in the reuse mode, the presence will not be created, call onnewintent.
(4) SingleInstance, single-instance mode, separate in a task stack, reuse.
OK, that ' s all! Enjoy It
Android Development Tips (2)