IllegalStateException when click on button in android hello world program

前端 未结 5 1804
耶瑟儿~
耶瑟儿~ 2021-01-19 16:06

I\'m new to android and I\'m trying to implement MyFirstApp given on android google developers site, So app contains one textbox and button, if you enter any text in textfie

5条回答
  •  迷失自我
    2021-01-19 16:53

    public void sendMessage(View view) {
        // Do something in response to button
        Intent intent = new Intent(this, DisplayMessageActivity.class);
        EditText editText = (EditText) findViewById(R.id.edit_message);
        String message = editText.getText().toString();
        intent.putExtra(EXTRA_MESSAGE, message);
        this.startActivity(intent);
    }
    

提交回复
热议问题