Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

android.app.Application

 
Jeansonne Pierre
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeansonne Pierre
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might have the source:
http://source.android.com/source/index.html
 
Jeansonne Pierre
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic