why android need onCreate()?

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

why android need onCreate()?

Postby bins1984 » Wed Jun 23, 2010 8:23 am

Hi ,

As per android documents we know about Activity life cycle.But I want to know Why android need onCreate(),Onstart(),onResume(),onPause(),onStop(),onRestart().

When really the android calls onStop() calls.I wold like know what exactly and how android handles this methods in background.If any one knows please let share wit me?

Thanks
Binil Thomas P R
User avatar
bins1984
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Feb 08, 2008 8:20 am
Location: India

Top

Re: why android need onCreate()?

Postby MichaelEGR » Wed Jun 23, 2010 12:41 pm

Are you sure your questions aren't answered by the documentation. This is is one of the more complete documentation files and pretty clearly explains when and why these methods exist and are called.

http://developer.android.com/reference/ ... ivity.html

You will want to take note of the AndroidManifest.xml as well since there are many settings there. One in particular is important to understand and that is:
android:configChanges="keyboardHidden|orientation"

When you have the above line in your AndroidManifest.xml file for an Activity then the Activity won't restart when configuration changes occur. Config changes occur when opening/closing keyboard on device or orientation changes. Without this in the AndroidManifest.xml then everytime a device configuration change occurs your Activity will restart. This is usually not desirable, but is default behavior.
Founder & Principal Architect; EGR Software LLC
http://www.typhonrt.org
http://www.egrsoftware.com
User avatar
MichaelEGR
Senior Developer
Senior Developer
 
Posts: 147
Joined: Thu Jan 21, 2010 5:30 am
Location: San Francisco, CA

Top

Return to General

Who is online

Users browsing this forum: No registered users and 7 guests