Ahmad Abdul Hamid
Ahmad Abdul Hamid

Reputation: 1

Adding Fragment In Second Activity

when i adding fragment into second activity android studio warn me "'onCreate(Bundle)' is already defined in 'com.example.midexam.MainActivity2'"

enter image description here

how to solve it, can i change it?

Upvotes: 0

Views: 31

Answers (1)

Gemeaux
Gemeaux

Reputation: 76

You can only have one onCreate method inside an activity. Just remove the first onCreate and change setContentView to the correct layout.

Upvotes: 1

Related Questions