Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App (retired 2014) Getting Started with Android Introduction to Methods and Classes

habib kazemi
habib kazemi
2,041 Points

methods

I have a problem with methods I don't know methods name's are thing we choose them and it can be every thing or they are things that we should memorize them and each one do the special thing? for example :

   protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

which one is method? what is every one?

1 Answer

Matheus G Oliveira
Matheus G Oliveira
9,682 Points

The onCreate() is a method

you call it when the app is created

What is inside of a method is its parameters Ex.: onCreate (Bundle savedInstanteState)

the setContentView is to tell which layout(xml) you will use for that class