2つのボタンが含まれるRadioGroupがあります。
「作成」ボタンがあり、押すと2つのアクティビティのいずれかが開始されます。「作成」ボタンが押されたときに最初のラジオボタンである検索がチェックされている場合、「ProductSearch」アクティビティが開くはずです。
「作成」ボタンが押されたときに2番目のラジオボタンtypeがチェックされている場合、「TypeEntries」アクティビティが開くはずです。ただし、今のところ、どのRadioButtonが押されても、「ProductSearch」が開きます。
したがって、検索では機能しますが、入力は機能しません。
RadioButton search = (RadioButton) findViewById(R.id.radio1);
RadioButton type = (RadioButton) findViewById(R.id.radio2);
Button create = (Button) findViewById(R.id.create);
if(search.isChecked()){
create.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent createIntent = new Intent(getApplicationContext(), ProductSearch.class); // <----- START "SEARCH" ACTIVITY
startActivityForResult(createIntent, 0);
}
});
}else if(type.isChecked()){
create.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent typeIntent = new Intent(getApplicationContext(), TypeEntries.class); // <----- START "TYPE ENTRIES OUT" ACTIVITY
startActivityForResult(typeIntent, 0);
}
});
}
}
}