Hey developers there、Androidスタジオ:textView.setText(button1.getText()); does not work
ボタンをクリックすると、textViewのテキストをボタンのテキストに変更したいと考えています。私はすでにいくつかのコードを試してみましたが、何も問題なく、私のアプリはエラーなしで停止しています。
これは私のコードです:
TextView textView1 = (TextView) findViewById(R.id.textView1);
Button button1 = (Button) findViewById(R.id.button1);
textView1.setText(button1.getText());
は、あなたの助けのためにすでにいただきありがとうございます:)
編集を:それはIllegalStateExceptionが、にInvocationTargetExceptionとNullPointerExcpetionをスローします。
https://stackoverflow.com/help/mcve – arekolek