Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio how to put java classes to different folders without corrupting autosuggest?

When I create new package to organize files and folder Android Studio is not suggest me classes which begins with _ this sign, what is the reason? Should I create packages to organize java classes or there is anotber way which is not affecting Android studio. Should I create new manifest file each time I create a new package Answer should cover all solutions about above questions.

like image 968
Ibrahim Hasanov Avatar asked Jul 01 '17 04:07

Ibrahim Hasanov


People also ask

Should different classes be in different files?

No, you can define multiple classes (and functions, etc.) in a single file. A file is also called a module.

What is MainActivity Java?

The main activity code is a Java file MainActivity.java. This is the actual application file which ultimately gets converted to a Dalvik executable and runs your application. Following is the default code generated by the application wizard for Hello World!

How can I change the location of file in Android Studio?

Click on Appearance and Behavior option > System Settings options and then click on the Android SDK option to get to see the below screen. Inside this screen, you will get to see your SDK path. You can update your SDK path by clicking on the Edit option.


1 Answers

Android Studio how to put java classes to different folders without corrupting autosuggest?

  1. Create the new package (folder)
  2. Place cursor on the class definition that you want to to move
  3. Press F6 key
  4. Select To Package and enter path to the newly created package
  5. Press Refactor

Should I create packages to organize java classes

Yes. Organize them in a hierarchy of packages. There are 2 popular techniques with self-explanatory names:

  1. Package by layer (ui, services, broadcasts etc.)
  2. Package by feature (login, main, settings, sharing etc.)

Here is a neat guide on how to organize your android project, especially the part on how to organize packages.


Should I create new manifest file each time I create a new package

No. One manifest file covers one complete module. (The 'app' folder is one module. There can be many in a single project. In case of many, each module will have its own manifest file.)

like image 148
Abdul Wasae Avatar answered Oct 10 '22 17:10

Abdul Wasae