Time for action - writing the ReviewActivity class
As already said, we will need to set up our tabbed-layout structure in our Java code. Fortunately, Android provides a very useful
TabActivity class that does much of the heavy lifting for us, providing us with a ready-made
TabHost object with which we can construct the
Activity tab structure.
- Open the
ReviewActivity.javafile generated earlier in an editor or IDE.
- Instead of extending
Activity, change the class to inherit
public class ReviewActivity extends TabActivity
- In the
onCreatemethod, remove the
setContentView(R.layout.main)line (generated by the
android create projectutility) completely.
- Now start by fetching the
TabHostobject from your parent class:
TabHost tabs = getTabHost(); ...