私はArrayList
にEditText
フィールドを編集した5人のユーザーを渡して、次のアクティビティにToggleButon
を入力しようとしています。複数のuserInputをArrayListに渡すにはどうすればいいですか?
私のJavaコードに"method call expected"
エラーが表示される理由がわかりません。
私はすでに自分の活動をしているのに、まだ壁に当たっている私のuserInput ArrayList
を開始しました。いくつかの有用なドキュメントへ
任意のコードの提案やリンクは、多くのJavaはArrayListの上のメソッドを呼び出すことを期待して、代わりにあなたはそれの近くに括弧を入れているため、エラーがある
public class MainActivity extends AppCompatActivity {
EditText venueOption1;
EditText venueOption2;
EditText venueOption3;
EditText venueOption4;
EditText venueOption5;
Button UpdateVenueButton;
public static ArrayList<String> userInput;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
venueOption1 = (EditText) findViewById(R.id.venueOption1);
venueOption2 = (EditText) findViewById(R.id.venueOption2);
venueOption3 = (EditText) findViewById(R.id.venueOption3);
venueOption4 = (EditText) findViewById(R.id.venueOption4);
venueOption5 = (EditText) findViewById(R.id.venueOption5);
UpdateVenueButton = (Button) findViewById(R.id.button);
userInput = new ArrayList<>(4);
UpdateVenueButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
venueOption1 = (EditText) findViewById(R.id.venueOption1);
getUserInput(userInput.get(0));
venueOption2 = (EditText) findViewById(R.id.venueOption2);
getUserInput(userInput(1));
venueOption3 = (EditText) findViewById(R.id.venueOption3);
getUserInput(userInput(2));
venueOption4 = (EditText) findViewById(R.id.venueOption4);
getUserInput(userInput(3));
venueOption5 = (EditText) findViewById(R.id.venueOption5);
getUserInput(userInput(4));
Intent intent = new Intent(v.getContext(), VenueOptions.class);
startActivity(intent);
}
});
}
を行う必要があります)と実際のエラーテキスト/ stacktraceを比較します。 –
リンクではなく、あなたの質問にコードを入れてください。 –
また、 'public static Arraylist'は、アクティビティ間でデータを渡すための悪い考えです。インテントエクストラを正しく使うことを学ぶ –