I am following the Sams 24hr programming book, but for the life of me cannot seem to fix an issue i am having with Hour 2.
I am trying to create a simple button that launches a second activity and changes the TextArea on the second activity.
This is my code for the second activity. I am getting "Expression Expected" on the Intent in "Intent= getIntent();" and "getStringExtra" is non static method cannot be referenced from static content.
My code looks the same as my book :S
package co.jamesbrown.hour2app;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class Second extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
Intent= getIntent();
String message = Intent.getStringExtra("co.jamesbrown.MESSAGE");
TextView messageTextView = (TextView) findViewById(R.id.message);
messageTextView.setText(message);
}
}
Thanks in advance
James