Reputation: 461
I don't know why I get an error on the name FirstActivity?
public class FirstActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.onStart();
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
Upvotes: 0
Views: 1934
Reputation: 426
Remove super.onStart() from your code.
And this link will help you.
http://developer.android.com/reference/android/app/Activity.html
Upvotes: 1
Reputation: 174
It would be helpful to know what error you've got, but I think the problem is the
super.onStart();
line in your code.
onStart()
would be called by the activity after onCreate()
and you dont have to call it by yourself (Source).
Upvotes: 2
Reputation: 82533
There are a few errors in your code:
public class FirstActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
You do not need to call super.onStart() in onCreate().
Other than that, your error could be because you have a mismatched constructor somewhere (Activities to need need constructors), or because your .java file has a different name.
Upvotes: 0