Created
November 2, 2011 16:37
-
-
Save khannedy/1334133 to your computer and use it in GitHub Desktop.
RadioButton di Android
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
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { | |
public void onCheckedChanged(RadioGroup group, int checkedId) { | |
} | |
}); |
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
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { | |
public void onCheckedChanged(RadioGroup group, int checkedId) { | |
TextView textView = (TextView) findViewById(R.id.textStatus); | |
if (checkedId == R.id.radioLakiLaki) { | |
textView.setText("Anda Laki-Laki"); | |
} else { | |
textView.setText("Anda Perempuan"); | |
} | |
} | |
}); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
android:orientation="vertical" > | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="Jenis Kelamin Anda :" /> | |
<RadioGroup | |
android:id="@+id/radioGroup" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" > | |
<RadioButton | |
android:id="@+id/radioLakiLaki" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="Laki-Laki" /> | |
<RadioButton | |
android:id="@+id/radioPerempuan" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="Perempuan" /> | |
</RadioGroup> | |
<TextView | |
android:id="@+id/textStatus" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="" /> | |
</LinearLayout> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
android:orientation="vertical" > | |
<RadioGroup | |
android:id="@+id/radioGroup" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" > | |
</RadioGroup> | |
</LinearLayout> |
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
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radioGroup); |
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
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { | |
public void onCheckedChanged(RadioGroup group, int checkedId) { | |
TextView textView = (TextView) findViewById(R.id.textStatus); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment