-1

I'm new to Android Studio and I keep on looking for an answer for this but unfortunately, I wasn't able to. I'm having a problem with creating a New > Activity when I saw a video and I think I'm missing something.

Comparison of my Android Studio and in the video, I watched earlier:

enter image description here

I already tried right clicking the exact thing on the other photo and right clicking everywhere in every folder still I can't find the New > Activity.

Mohammad Roshani
  • 486
  • 7
  • 19
  • Look at this question / answer https://stackoverflow.com/questions/16641643/how-to-add-new-activity-to-existing-project-in-android-studio – ditkin Mar 15 '19 at 17:14
  • Pay close attention to the file structure where you are attempting to create the new activity. –  Mar 15 '19 at 17:17

5 Answers5

1

You are trying to create an Activity inside the res folder, instead, right click inside the app folder (main)

I see that your project is not correctly builded seeing your MainActivity.class

go to build - clean project and then rebuild project.

Gastón Saillén
  • 12,319
  • 5
  • 67
  • 77
  • My photo is a new project, I haven't done anything yet in that photo. I tried creating a new project and tried what you said but still it won't show up. Any suggestions? btw Thank you for reply – Christian Kwan Mar 15 '19 at 17:18
  • It seems like your project did not build correctly, try to rebuild the project doing the last step in my answer – Gastón Saillén Mar 15 '19 at 17:20
  • I tried clean project and rebuild and right clicking everywhere even app folder (main) still it won't show up – Christian Kwan Mar 15 '19 at 17:26
1

Try updating your studio or use invalidate cache/restart or delete .idea folder and try again, like given in this post.

Try using this meanwhile if it works.

File->New->Activity

enter image description here

vikas kumar
  • 10,447
  • 2
  • 46
  • 52
0

It seems your project is not properly built, go to build - clean project and then rebuild project. After that you can create an activity by doing a right click on the Java folder or the root folder

JideGuru
  • 7,102
  • 6
  • 26
  • 48
0

The same problem is currently occurs with many users. Mean while you can do as following way.

PRESS CTRL+SHIFT+A

It will open quick action dialog.

Type whatever you want to do. like "New Activity"

It will display as below:

enter image description here

Thank you.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
0

First of all make sure that you are in the App view of your project. The app view

Then, simply right click app->New->Activity. You might want to choose Gallery... to see a better preview of all the activities. By doing it this way, Android Studio will create all the related Java classes too in the appropriate package in the java folder.

If you are not able to add a new activity following my answer, try rebuilding your project and try Invalidate Cache/Restart as other answers suggested.

MrObjectOriented
  • 274
  • 3
  • 12