-
-
Save Bonetank/ee829771973e13ae6a4e3545d7e541dc to your computer and use it in GitHub Desktop.
Quiz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.android.quizpsikologi; | |
import android.content.Intent; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.CheckBox; | |
import android.widget.Button; | |
import android.widget.CompoundButton; | |
import android.widget.TextView; | |
//import java.text.NumberFormat; | |
// | |
//import static android.R.attr.id; | |
//import static android.R.attr.name; | |
public class MainActivity extends AppCompatActivity { | |
//private int answer = 0; | |
private CheckBox agreementcheckbox; | |
private Button buttonnext1; | |
private int haschecked = 0; | |
private TextView testuji; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
agreementcheckbox = (CheckBox) findViewById(R.id.agreement); | |
buttonnext1 = (Button) findViewById(R.id.next1); | |
testuji = (TextView) findViewById(R.id.test); | |
} | |
public void enable (View view) | |
{ | |
if (agreementcheckbox.isChecked()) | |
{ | |
haschecked = 1; | |
} | |
else | |
{ | |
haschecked = 0; | |
} | |
testuji.setText("" + haschecked); | |
condition(haschecked); | |
} | |
public void condition (int number) | |
{ | |
if (number >=1 ) | |
{ | |
buttonnext1.setEnabled(true); | |
} | |
else | |
{ | |
buttonnext1.setEnabled(false); | |
} | |
} | |
public void activity_main2 (View view) | |
{ | |
//Intent activity_main2_Page = new Intent (this, Main2Activity.class); | |
//startActivity(activity_main2_Page); | |
testuji.setText("Masih Bisa"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment