aspose file tools*
The moose likes Android and the fly likes android.app.Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "android.app.Application" Watch "android.app.Application" New topic
Author

android.app.Application

Jeansonne Pierre
Greenhorn

Joined: Sep 11, 2011
Posts: 12
Hi all, I'm beginner here.

the open source code from package android.app.Application for method onCreate() is as below

/**
* Called when the application is starting, before any other application
* objects have been created. Implementations should be as quick as
* possible (for example using lazy initialization of state) since the time
* spent in this function directly impacts the performance of starting the
* first activity, service, or receiver in a process.
* If you override this method, be sure to call super.onCreate().
*/

public void onCreate() {
}

My question is
1) why nothing implement inside the body of onCreate() method for package android.app.Application?

2) if i create a class extends Application, i'm wondering why compiler will automatically run the onCreate() method from android.app.Application ->
public void onCreate()
{
// nothing inside here
}

since the body is empty... why the onCreate() method will run automatically?

3) why need to call the super.onCreate() since the body is empty?

please help
Thanks
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5837
    
    7

Which sources are you looking at? The ones for the SDK just mimic the API and don't do anything (they are all empty or have default return values). The actual code that runs in the emulator or on the device has the real code.


JBoss In Action
Jeansonne Pierre
Greenhorn

Joined: Sep 11, 2011
Posts: 12
opps... means that it is not a real source code? i get it from
Application.Java

can you show me the real code?
thanks...
Vishal Trivedi
Ranch Hand

Joined: Sep 05, 2011
Posts: 57
Why do you want it to do anything?

After all its your class that will do all the coding.

Systems are designed in such a way that they refer to calls to classes like these.So when you extend a class like this(something similar to the servlets Api) and call super it is then your class is identified by the system. I guess so!!!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5837
    
    7

This might have the source:
http://source.android.com/source/index.html
Jeansonne Pierre
Greenhorn

Joined: Sep 11, 2011
Posts: 12
conclusion is
http://www.google.com/codesearch/p?hl=en#uX1GffpyOZk/core/java/android/app/Application.java
is not a real source code??

Thanks everybody
 
Consider Paul's rocket mass heater.
 
subject: android.app.Application