このメソッドをhttps://github.com/makeramen/android-segmentedradiobuttonからインポートしました。各ボタンがクリックされたときにビュー(リストビュー、イメージビューなど)を表示する方法。
ここにコードがあります..
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub
if (group == segmentText) {
if (checkedId == R.id.button_one) {
Toast.makeText(getApplicationContext(), "Featured",
Toast.LENGTH_SHORT).show();
} else if (checkedId == R.id.button_two) {
Toast.makeText(getApplicationContext(), "NearBy",
Toast.LENGTH_SHORT).show();
} else if (checkedId == R.id.button_three) {
Toast.makeText(getApplicationContext(), "Whatsup",
Toast.LENGTH_SHORT).show();
}
}
}