Issue while added the new package under existing Package: Android Studio - android-studio

I added a new activity which is under following Package
Activities -> UserManagement -> Auth -> Login
Here is the screenshot
Now, I am trying to add a new Package which should be under Activities Package.
Here the problem is that I have no option to add a new Package under Activities because they are combined with dot.
Can you please suggest how could I add the new Package under Activities.

Create a new file by performing a right click on the package shown and Create a new Class file.
In the window that opens up, once you type in the filename, there will be another textbox called Package where a specific package path will be shown. Edit that to the required package location where this file has to be created. This will automatically expand the tree structure shown in Android Studio.

Related

How to change defualt package name when creating new project in android studio

when I create new project I get default package I change it the next time I got the same default package name I want to set my default package name
Change your application name and after that your package name will change automatically. You also can pick the package name you like.

Can't create Sample Data Directory - Android Studio

I"m trying to Create a sample data directory, using Android Studio, by clicking on app in the project view and then right mouse click to find the menu item New > Sample Data Directory.
It is not working.
Creating the directory via android studio doesn't always work. You may need to create the directory manually in your directory structure (at /app/sampledata/) without using Android Studio. Once you create it (e.g., via Windows Explorer) it should show up in Android Studio. See the the following answer for more information about sample data in general: How to put new placeholder resources into Android Studio project ("tools:sample" resources)?
"Unlike resources like images, fonts, etc. The sample data does not go in /res/ (they are not compiled with the app, hence. It is probably easier to filter them out by putting them in a totally separate directory). They go in /app/sampledata/, for example: /app/sampledata/image.png."
You can create a sample data directory in Android Studio itself by following the below steps:
Change the view of directory structure from Android to Project as follows
Right click app folder and select New->Directory
Finally, give a name to your directory, in your case, it should be sampledata
I have already created sampledata directory that's why it says "Directory already exists".
That's it. You have done it. Remember that Android Studio also supports loading sample data from a json file. All you have to give is fully qualified name of the key residing in the json file.
Ex- if your json file contains key name inside a Json Array student, then you have to specify it as "#sample/your_student_file.json/student/name" to use values present in key name.
Unless your issue happens to be different, this is a known issue that only affects Windows. As I've found, it has something to do with 'C:\' in the file path.
https://issuetracker.google.com/issues/124553391
As Shawn mentioned, you need to manually create the directory.
I've been unable to get the images to actually display in the previewer, which I suspect may also be caused by the file path bug.
Inside the app folder in file explorer, You can create a new folder (sample data) which will be reflected in your android studio.

How do you create a folder in Android Studio

File -> New and the context menu dont have an option of creating a folder, just files and other stuff.
I'm making a flutter app and want a new folder insie lib.
Or right-mouse click on a parent folder and New -> Package
Right click on the lib folder, select New and then select Package.

How to change the content of module that Android Studio's auto-generated?

I known there is a thing called template to solve this problem. The question is i want config something when creating module step by step. In other word, i want a more flexible method to generate android module. So i prepare to develop a plugin to do this. And what's more, I know the official plugin use AndroidModuleBuilder,AndroidWizardWrapper and other classes to generate module. So is there any possibilty to extend official android module function and add some other functions to wizard?
You're looking for "project template".
Open this folder in the Android Studio installation folder:
Android Studio/plugins/android/lib/templates
You'll see folders that contains some files ends with ".ftl", just edit them and create a new project again, and you'll see the effect.
To add steps during the module creation, you need to edit and compile your own "Android Support" plugin, AFAIK. Because I don't think they've provided APIs (extension point) for adding steps during module creation.
You may do something in the implementation of com.intellij.ide.util.projectWizard.ModuleWizardStep#updateDataModel (executed during the step), and com.intellij.ide.util.projectWizard.ModuleBuilder#setupRootModel (executed when you clicked "Finish" button).
You can get the project root directory by com.intellij.openapi.roots.ModifiableRootModel#getProject, while com.intellij.openapi.roots.ModifiableRootModel is the parameter of setupRootModel.

Project not running in myeclipse

I copied the project(folder) into the myeclipse environment folder and when i try to run it , it is giving the following error :
Problems occurred opening the selected resources.
The project description file (.project) for 'activity tracker' is missing. This file contains important information about the project. The project will not function properly until this file is restored.
activity tracker is the name of the project
How do i generate this file ?
i am currently running
MyEclipse Enterprise Workbench Version: 8.6
Delete the project from the workspace but don't delete the project files on disk (this is an option during the delete process). Then create a project, of the appropriate type, with the same name, in the same location (defaulted to the workspace). I'm not sure if you'll be prompted to reuse the files already in the project location but you can play it by ear.
Alternatively, move the project to another folder. Create a new project with the same name, of the same type, and add the appropriate capabilities. Then copy your source in from the moved old project.
Tip: 8.5 is very old, consider moving to the latest release, with loads of fixes and new features.

Resources