-5

I have just started a new eclipse project and when I create an android project their is no main.java in the src folder. Should I create one or what?

Also, I am using the eclipse that I got in the android adt bundle and not the eclipse on the eclipse website

A--C
  • 36,351
  • 10
  • 106
  • 92
user2426533
  • 441
  • 3
  • 7
  • 13

2 Answers2

2

You could create a main.java with no problem in your src folder. But I would recommend you to recreate the project for easiness. Make sure that in the new project dialog you marked the box that says create activity.

neoprez
  • 349
  • 2
  • 11
0

In general, the link that Dyrborg provided is a good starting point:

stackoverflow.com/questions/9293329/where-is-main-in-android

The general answer to your question is that in Android development, there is no main.java or public static void main(string[] args) entry point. Although there is a single Application class which Android uses to manage your application, you shouldn't access it until you understand more general concepts of an Android application lifecycle. What you want to look into, and your first starting point, is your main Activities methods. In particular onCreate(), onStart(), onResume() and onPause().

I suggest you take the time to read the Android tutorials, in particular this article on Activities, which are the main entry points you need to be concerned with initially.

http://developer.android.com/training/basics/activity-lifecycle/index.html

TheIT
  • 11,919
  • 4
  • 64
  • 56