private static class loginHandler extends Handler {
private final WeakReference<LoginActivity> loginActivity;
public loginHandler(LoginActivity activity) {
loginActivity = new WeakReference<LoginActivity>(activity);
}
@Override
public void handleMessage(Message msg) {
LoginActivity activity = loginActivity.get();
if (activity != null) {
switch (msg.what){
case 0:
break;
case 1:
Intent intent=new Intent(activity,TEMainActivity.class);
activity.startActivity(intent);
break;
}
}
}
}
private final loginHandler loginHandler = new loginHandler(this);
handler的正确写法
最新推荐文章于 2023-06-07 08:00:00 发布