При нажатии на кнопку выкидывает из приложения.С 32 по 40 строку. А именно: `
Button btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Eng_lvl.this, Eng_learn.class);
startActivity(intent);
finish();
}
});`
package com.daylang.daylang;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import java.util.Calendar;
public class Eng_lvl extends AppCompatActivity {
private int curTime;
private int someValue;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.loadscreen);
Calendar calendar = Calendar.getInstance();
//noinspection WrongConstant
if (calendar.get(Calendar.DATE) == 1) {
setContentView(R.layout.eng_lvl);
}
else if (calendar.get(Calendar.DATE) == Calendar.WEDNESDAY) {
setContentView(R.layout.eng_learn);
}
StartAnimations();
Button btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Eng_lvl.this, Eng_learn.class);
startActivity(intent);
finish();
}
});
}
private void StartAnimations() {
Animation anim = AnimationUtils.loadAnimation(this, R.anim.mytrans);
anim.reset();
ImageView iv = (ImageView) findViewById(R.id.stars);
iv.clearAnimation();
iv.startAnimation(anim);
anim = AnimationUtils.loadAnimation(this, R.anim.mytrans2);
anim.reset();
ImageView l = (ImageView) findViewById(R.id.stars2);
l.clearAnimation();
l.startAnimation(anim);
anim = AnimationUtils.loadAnimation(this, R.anim.mytrans5);
anim.reset();
ImageView B = (ImageView) findViewById(R.id.stars3);
B.clearAnimation();
B.startAnimation(anim);
}
}
calendar.get(Calendar.DATE) == Calendar.WEDNESDAY
сравнивать число в месяце со средой, занятие немного странное.