我希望在点击按钮一段时间后开始新的活动,但问题是首先我要重新创建A.activity,而不是在几秒钟后启动B.activity。
animation2.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
en.setVisibility(View.VISIBLE);
al.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
en.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
locale = new Locale(" ");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
LanguageActivity.this.recreate();
startActivity(new Intent(LanguageActivity.this, ServicesActivity.class));
}
});
答案 0 :(得分:0)
我想在按一下按钮
一段时间后开始一项新活动
en.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//...
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startActivity(new Intent(LanguageActivity.this, ServicesActivity.class));
}
}, 5 * 1000); // 5 seconds
}
});