To show the message on the screen, create a TextView widget and set the text using setText(). Then add the TextView as the root view of the activity’s layout by passing it to setContentView().
The complete onCreate() method for DisplayMessageActivity now looks like this:
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
// Get the message from the intent Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
// Create the text view TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message);
// Set the text view as the activity layout setContentView(textView); }
You can now run the app. When it opens, type a message in the text field, click Send, and the message appears on the second activity.
Figure 2. Both activities in the final app, running on Android 4.0.
That's it, you've built your first Android app!
To learn more about building Android apps, continue to follow the basic training classes. The next class is Managing the Activity Lifecycle.
The Middle Ages - 1066 and all that
Architecture is about evolution, not revolution. It used to be thought that once the Romans pulled out of Britain in the fifth century, their elegant villas, carefully-planned towns and engineering marvels like Hadrian's Wall simply fell into decay as British culture was plunged into the Dark Ages. It took the Norman Conquest of 1066 to bring back the light, and the Gothic cathedral-builders of the Middle Ages played an important part in the revival of British culture.
The great cathedrals and parish churches that lifted up their towers to heaven were acts of devotion in stone...
However, the truth is not as simple as that. Romano-British culture - and that included architecture along with language, religion, political organisation and the arts - survived long after the Roman withdrawal. And although the Anglo-Saxons had a sophisticated building style of their own, little survives to bear witness to their achievements as the vast majority of Anglo-Saxon buildings were made of wood.
Even so, the period between the Norman landing at Pevensey in 1066 and the day in 1485 when Richard III lost his horse and his head at Bosworth, ushering in the Tudors and the Early Modern period, marks a rare flowering of British building. And it is all the more remarkable because the underlying ethos of medieval architecture was 'fitness for purpose'. The great cathedrals and parish churches that lifted up their towers to heaven were not only acts of devotion in stone; they were also fiercely functional buildings. Castles served their particular purpose and their battlements and turrets were for use rather than ornament. The rambling manor houses of the later Middle Ages, however, were primarily homes, their owners achieving respect and maintaining status by their hospitality and good lordship rather than the grandeur of their buildings.
Fitness for purpose also characterised the homes of the poorer classes. Such people didn't matter very much to the ruling elite and so neither did their houses. These were dark, primitive structures of one or two rooms, usually with crude timber frames, low walls and thatched roofs. They weren't built to last. And they didn't.