Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create different folders to organize source code in Android Studio?

I want to separate my Java source code into different folders (e.g. folders for activities, fragments, etc like in https://blog.smartlogic.io/2013-07-09-organizing-your-android-development-code-structure/)

How do I create the new folders in Android Studio. The thing I thought might work is 'Right Click On The Package -> New -> Folder -> Java Folder' but this did not appear to do anything.

enter image description here

like image 939
n4rush0 Avatar asked Dec 16 '17 15:12

n4rush0


2 Answers

If you want to make a folder to put your Java files in it then go to -> new-> package and then move your files there but don't forget to change the package name in each file you move to the new package file.

like image 119
Ezaldeen sahb Avatar answered Sep 25 '22 17:09

Ezaldeen sahb


Packages

See the Java Tutorial on Packages.

A package in Java not only groups your classes together, it creates a namespace.

By convention, use a domain name in reverse direction to name your package.

package com.example.awesomeapp.login ;
like image 24
Basil Bourque Avatar answered Sep 23 '22 17:09

Basil Bourque