Packages are grouped collections of classes. If you look at the top of the code that we have written so far, you will see these lines of code.
import android.app.Activity; import android.os.Bundle;
These lines of code make available the Activity
and Bundle
classes as well as their methods. Comment out the above two lines like this:
// import android.app.Activity; // import android.os.Bundle;
Now look at your code and you will see errors in at least three places. The word Activity
has an error because Activity
is a class which Android Studio no longer is aware of in the following line:
public class SubHunter extends Activity {
The word onCreate
also has an error because it is a method from the Activity
class and the word Bundle
has an error because it is a class which since we commented out the previous two lines Android is no longer aware of. This next line highlights where the errors are.
protected void onCreate(Bundle
savedInstanceState) {
Uncomment the two lines of code...