MyFirstAppチュートリアルAndroidスタジオアプリ内でのメッセージの受信に関する問題。次のようにMyFirstAppチュートリアルAndroidスタジオ2.3ビルドエラーEXTRA_MESSAGEとテキストビュー
ビルドエラーは以下のとおりです。
Error:(17, 60) error: cannot find symbol variable EXTRA_MESSAGE
Error:(20, 57) error: cannot find symbol variable textView
メッセージ受信のための私のコードは次のようになります。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
// Get the Intent that started this activity and extract the
string
Intent intent = getIntent();
String message =
intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
// Capture the layout's TextView and set the string as its text
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText(message);
}
注:EXTRA_MESSAGEとTextViewには赤です。
送信するコードは次のようになります。
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
/** Called when the user taps the Send button */
public void sendMessage(View view) {
Intent intent = new Intent(this,
DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.editText);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
}
注:上記の私のコードでこの行で:
public void sendMessage(View view)
最初の「ビュー」はそれとIを介して光水平線を持っていますsendMessage(ビュービュー)のようなエラーメッセージが表示されます。
私が...問題は
public void sendMessage(View view)
とその償却コードメッセージに関連するかもしれないと思う問題が発生したチュートリアルの
リンク(?):
https://developer.android.com/training/basics/firstapp/starting-activity.html