Basically I want to press a button and display a predefined string variable in a new blank window. I've tried several methods and none work. This is my first app ever so I dont have much knowledge on how to use classes. this is the code I have now for the Onclick action
public void receivedata(View data) {
Intent intent= new Intent(this, ReceivedataActivity.class);
intent.putExtra("My Message", false);
startActivity(intent);
}
and this is the code I have on the class
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.receivedata);
Intent intent = getIntent();
String message = intent.getStringExtra("My Message");
TextView comm = (TextView) findViewById(R.id.textView1);
comm.setTextSize(40);
comm.setText(message);
setContentView(comm);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
The App just crashes whenever I press the button... any ideas on how to do this?
This is what the LogCat says: this is what te logcat says E/AndroidRuntime(11090): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mcudisplay/com.example.mcudisplay.ReceivedataActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity