3

I am currently writing an Android App using Android Studio 1.2. However, i cannot find MainActivity.java file in it.

Hope someone can help me out.

Thanks in advance.

Regards, Al

Al_Stackoverflow
  • 31
  • 1
  • 1
  • 3
  • 3
    Can we see a screenshot of your project structure? – Joe Birch May 03 '15 at 16:48
  • Thank you all the replies. When I follow the path, app then java, what I can see next is com.a, and that's it. I cannot open that file (com.a) at all. What I want to do is to import different widgets and properties to my app. Would be grateful if someone can solve it out. Thanks! – Al_Stackoverflow May 07 '15 at 12:47
  • com.a sounds like a package to me, does it have a package icon to the left of it? If so, you need to right click and select New and then the file type you wish to create. (You should probably rename that package too!) – Joe Birch May 07 '15 at 22:27
  • What should I click after right click? Kindly advise @JoeBirch – Al_Stackoverflow May 09 '15 at 00:46
  • While creating a new project, make sure you click on **"Empty Activity"** instead of no activity – DC007744 Mar 28 '22 at 07:14

4 Answers4

1

I have Android Studio 1.2 too. In the left side:

  • Choose 1: Project if it isn´t already open.
  • Then choose app, then java.
  • Then choose com.username.project.
  • Finally choose MainActivity.java.
Kargavibe
  • 21
  • 4
1

Its not necessary that your file is named MainActivity.java. That is the default name. If you created the Java file with another name while making the project then that will be your main Activity file. It will have the name you gave while making the project.

Otherwise just create a new activity and enter its name in the Manifest file to make it the main activity.

Jyotman Singh
  • 10,792
  • 8
  • 39
  • 55
0

When you create new project select Blank Activity. MainActivity file is in Android -> app -> java -> your.package.name

Daniel Kuta
  • 1,634
  • 15
  • 24
0

Inside of android folder navigate to

app --> src --> java --> com --> "your app name"

Zainab Hammami
  • 411
  • 2
  • 6
  • 15