Alright so the thing is, you can't edit a view if you haven't set your layout. Thats where you're nullpointer is coming from; your current Layout doesn't have the textView you're looking for.
What you can do, is pass through your info through an intent to the new activity and switch it there
Button btn_marine = (Button) findViewById(R.id.btn_unit_marine);
btn_marine.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, UnitActivity.class);
intent.putExtra("unitType","marine")
startActivity(intent);
}
});
And in your next activity's onCreate, after you set the layout:
Bundle extras = getIntent().getExtras();
String unitType = extras.getString("unitType");
if (unitType.equals("marine")) {
TextView unitNameView = (TextView) findViewById(R.id.textViewUnitName);
unitNameView.setText("Marine!");
}
etc etc.
Its rough, because passing it as a string is a bad idea (pass it as a switchable object, theres tons of units man!), and put the view switching in its own function / class so you don't clutter up your onCreate(). But the general logic of passing things through in Android is here, you can figure out the rest :)