先看看Activity的基类抽取
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.view.View;
/**
* @Auther: 殒命星
* @Date: 2019/1/19 10:33:${}
* @Description:
*/
public abstract class BaseActivity extends FragmentActivity {//继承这个地方可以继承Activity也可以继承FragmentActivity
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(bindLayout());
initView();
initData();
bindEvent();
}
protected abstract int bindLayout();
protected abstract void initView();
protected abstract void initData();
protected abstract void bindEvent();
protected <T extends View> T bindView(int resId){
return (T) findViewById(resId);
}
}
Fragment的基类抽取
import android.os.Bundle;
import android.support.a