Sometimes we need to separate our java classes according to their functionality. Keeping various java classes in different package name make the project more understandable for anyone.
How to Create/Add new Package inside src folder in Android Studio
The following are the steps to add new Package name inside src folder:
Step 1: Open Android Studio and Navigate to any view(Android or Project)
Step 2: In Android View you will have two folders: app and Gradle Scripts
Step 3: Open App folder then open Java folder. Right click on Java folder and select New > Package.
Step 4: Choose directory destination which main\java and click OK.
Step 5: Give a name to new Package(For example: samplePackage). Click Ok.
Step 5: Now you have samplePackage inside JAVA folder. You can keep separate Java files inside it.
when I create a package inside the package it will combine with the first one. At first, I created a package name model then I create another package inside model I,e datamodel it will create like model.datamodel .How I can fix it?
then how to make another package inside samplepackage?
In above tutorial u showed how to create the package in src directory.but how to import the same package in any other java file
How to make a new “res” folder?
Hi,
Here we show how to create raw folder https://abhiandroid.com/androidstudio/create-raw-folder-android-studio.html
Similarly you can create ‘res’ folder or any folder you want in Android Studio.