public abstract class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView();
ViewUtils.inject(this);
initTitle();
initView();
initData();
}
protected abstract void initData();
protected abstract void initView();
protected abstract void initTitle();
protected abstract void setContentView();
/**
* 启动activity
*/
protected void startActivity(Class> clazz) {
Intent intent = new Intent(this, clazz);
startActivity(intent);
}
/**
* findviewbyld进行封装
*/
protected T findviewByld(@IdRes int viewld){
return (T) findViewById(viewld);
}
}