I'm developing a quiz game in Android Studio with 10 activities. For each question I have only two alternatives where I would get 1 for the chosen alternative and 0 for not chosen. I'd like to put these values in a two-dimensional array. How would I implement this in my code to then count these responses and set a profile for the person?
package com.example.bruno.limites;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
public class Pergunta01 extends AppCompatActivity {
private RadioGroup rdgOpcoes;
private Intent it;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pergunta01);
rdgOpcoes = (RadioGroup) findViewById(R.id.rdgOpcoes);
it = getIntent();
}
public void responder (View botao){
RadioButton rbotao = (RadioButton) findViewById(rdgOpcoes.getCheckedRadioButtonId());
String resposta = rbotao.getText().toString();
it.setClass(this, Pergunta02.class);
int respondidas = 0;
if(respondidas > 0){
respondidas++;
Toast.makeText(this, " Questao respondida ", Toast.LENGTH_LONG ).show();
}
it.putExtra("respondidas" , respondidas);
startActivity(it);
finish();
}
}