package com.example.roman.geoguiz;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.Button;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class GuizActivity extends AppCompatActivity {
private Button mTrueButton;
private Button mFalseButton;
private Button mNextButton;
private TextView mTV;
private int mCurrentIndex = 0;
TrueFalse[] mQuesitonBank = new TrueFalse[]{
new TrueFalse(R.string.onn, true),
new TrueFalse(R.string.inn, true),
new TrueFalse(R.string.gcc, true),
};
private void updeteQueation(){
int question = mQuesitonBank[mCurrentIndex].getQuestion();
mTV.setText(question);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_guiz);
mTV = (TextView) findViewById(R.id.TV);
mTrueButton = (Button) findViewById(R.id.button_true);
mFalseButton = (Button) findViewById(R.id.button_false);
mNextButton = (Button) findViewById(R.id.button_next);
mTrueButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View view){
Toast.makeText(GuizActivity.this, R.string.correct_toast, Toast.LENGTH_SHORT).show();
}
});
mFalseButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View view){
Toast.makeText( GuizActivity.this, R.string.incorrect_toast, Toast.LENGTH_SHORT).show();
}
});
mNextButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
mCurrentIndex = (mCurrentIndex++) % mQuesitonBank.length;
updeteQueation();
}
});
updeteQueation();
}
protected boolean onCreateOptionMeny(Menu menu){
return true;
}
}
package com.example.roman.geoguiz;
public class TrueFalse extends Object {
private int mQuestion;
private boolean mTrueQuestion;
public TrueFalse (int question, boolean trueQuestion){
mQuestion = question;
mTrueQuestion = trueQuestion;
}
public boolean isTrueQuestion() {
return mTrueQuestion;
}
public void setTrueQuestion(boolean trueQuestion) {
mTrueQuestion = trueQuestion;
}
public int getQuestion() {
return mQuestion;
}
public void setQuestion(int question) {
mQuestion = question;
}
}
Компилятор ошибок не выдает, зато приложение вылетает. Где возможна ошибка?
P.S. Тестирую на реальном устройстве с API 23