import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
public class MainActivity extends Activity {
private Animation zonghe;
private ImageView im;
int miao =3;
//handler方法
Handler handler = new Handler(){
public void handleMessage(android.os.Message msg) {
miao--;
if (miao == 0) {
//跳转
Intent intent = new Intent(MainActivity.this,Tiao.class);
startActivity(intent);
}
handler.sendEmptyMessageDelayed(1, 1000);
};
};
private SharedPreferences sha;
//移动通信
//1507A
//张一帆
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
im = (ImageView) findViewById(R.id.im);
zonghe = AnimationUtils.loadAnimation(MainActivity.this, R.anim.zonghe);
//让图片跟动画链接
im.startAnimation(zonghe);
//handler发送消息
handler.sendEmptyMessage(1);
sha = getSharedPreferences("文件", MODE_PRIVATE);
Editor edit = sha.edit();
boolean panduan = sha.getBoolean("deng", true);
if (panduan) {
edit.putBoolean("deng", false);
edit.commit();
}else {
Intent intent = new Intent(MainActivity.this,Tiao.class);
startActivity(intent);
}
}
}