import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.Toast;
/**
* Created by e531 on 2017/10/17.
*/
public abstract class BaseActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("zzz","base:onCreate");
//设置内容视图
setContentView(getLayout());
initView();
setListener();
initData();
}
//获取布局的id
public abstract int getLayout();
//查找页面上所有的组件
public abstract void initView();
//设置监听事件
public abstract void setListener();
//初使化数据
public abstract void initData();
//弹出吐司提示
public void getToast(String tip){
Toast.makeText(BaseActivity.this, tip, Toast.LENGTH_SHORT).show();
}
}
activity的工具类
最新推荐文章于 2023-11-01 17:30:45 发布