I basically want to start a new Activity, but here is the catch: I want the new Activity to start, when an "if-statement" is true. I created a simple counter and when the user reaches a certain number, lets say 10, the new activity should start. Thanks in advance!
Here is some code:
public class MainActivity extends AppCompatActivity {
//NUMBER FOR THE COUNTER
public int mCount = 100;
//SUBTRACTS 1 FROM THE COUNTER
public void remove() {
mCount--;
if (mCount <= 0) mCount = 0;
}
//UPDATES THE COUNTER
private void updateGui() {
TextView textViewCount = (TextView) findViewById(R.id.textViewCounter);
String CountText = Integer.toString(mCount);
textViewCount.setText(CountText);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Aucun commentaire:
Enregistrer un commentaire