1
I am developing a small game just for friends and do some tests, the problem is that I know virtually nothing of programming and got stuck in the data saving part. I have read several times and seen some examples but I could not make it work with my code. I basically want to save the value of "Losers by touch".
private Button botaoperder;
private TextView derrotas;
public int contador = 0;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
botaoperder= findViewById(R.id.botao1);
derrotas= findViewById(R.id.derrotas00);
botaoperder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
contador++;
derrotas.setText("Derrotas por toques: " + contador);
}
});
}
}
It worked perfectly, thank you.
– João Lucas