Started working on my first project using Android Studio instead of Eclipse ADT. I would like to add sub folders to contain java.classes in order to structure my app but are unable to obtain references to them in my activity
structure is (with app name replaced)
src/main/[MyCompany]/[myAppName]/model/user.java
and
src/main/[MyCompany]/[myAppName]/helperClasses/SQLiteHelper.java
however I am unable to reference them either directly in code or by import, and are forced to put them in the appName folder with the activity to reference them.
Is this simply a limitation in Android or is there a way to organize your project with folders better. I used the new->folder-java
folder option to create folders
The Java folder contains all the java and Kotlin source code (. java) files that we create during the app development, including other Test files. If we create any new project using Kotlin, by default the class file MainActivity. kt file will create automatically under the package name “com.
The src folder holds two most important folders on any Android project, namely, androidTest and main. The androidTest package is created to hold Test cases for testing the application code and running. This folder contains . java (JAVA) files.
Step 1: To create an asset folder in Android studio open your project in Android mode first as shown in the below image. Step 2: Go to the app > right-click > New > Folder > Asset Folder and create the asset folder. Step 3: Android Studio will open a dialog box. Keep all the settings default.
IntelliJIdea mixes packages and directories.
So, right click on the java folder, click new - 'Package', then add your directory.
In my case I wanted a mock package with java folder:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With