ADD file via upload

master
p10297854 4 years ago
parent f96aa55128
commit d7286a0c74

@ -0,0 +1,57 @@
package com.example.musicwork;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.os.Handler;
import android.view.KeyEvent;
public class StartActivity extends AppCompatActivity {
private Handler handler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 注意此处将setContentView()方法注释掉
// setContentView(R.layout.activity_start);
handler.postDelayed(new Runnable() {
@Override
public void run() {
gotoLogin();
}
}, 1500);
}
/**
*
*/
private void gotoLogin() {
Intent intent = new Intent(StartActivity.this, SignIn.class);
startActivity(intent);
finish();
//取消界面跳转时的动画使启动页的logo图片与注册、登录主页的logo图片完美衔接
overridePendingTransition(0, 0);
}
/**
*
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void onDestroy() {
if (handler != null) {
//If token is null, all callbacks and messages will be removed.
handler.removeCallbacksAndMessages(null);
}
super.onDestroy();
}
}
Loading…
Cancel
Save