i am facing some android sub-module or aar lib problem.
I have one parent project and I want to add a different project into the my parent project (containing DI, network, activity, fragment). I think I have added successfully. My workspace looks like below screen shoot.
i also added in app gradle
implementation project(":GaleriDemo")
and added in settings.gradle
But when I try to open a sub-module activity in a click event in the Parent project. It doesn't open properly for some reason.
My library have some basic configuration for build like below screen shoot.
i tried like this to open my sub-module activity
When i clicked the button i am facing above screen shot behavior (like opening same activity in fragment.). But it should be opening my sub-module TestMainActivity, so i think i missed some configuration or some packageName settings. Thanks for your helping
The names of the layout resource in the problem sub-module and the names in the parent projects are the same. When I edit the layout names, my problem was solved.
Related
I made an Android layout file recently, and it worked like normal with being able to edit it via the text and design tabs.
Then, I don't know what I did, but the text in the file got grayed out, the android ui icon went away where the files are listed on the left hand side, and I can't call them from inside my Java code. What can I do to convert these files back to Android layout files? Cleaning and rebuilding doesn't work.
You can't put layout files into subfolders, that's why they're not working.
Move them out of the subfolder and into the main folder and they will work again.
As you know every time you create new project with some activity, Android Studio generates a default activity_main.xml file with RelativeLayout as the root element and one TextView. But I prefer to use LinearLayout without any nested views. How can I change the way Android Studio generates the default activity_main.xml?
You can do that by editing default template files, which are located in:
...\Android\Android Studio\plugins\android\lib\templates\activities
so for example, default layout file for template of EmptyActivity (note: this one is specific, the other ones have their own res folders) is located in:
...\Android\Android Studio\plugins\android\lib\templates\activities\common\root\res\layout\simple.xml.ftl
by simply replacing RelativeLayout with LinearLayout in your favourite text editor, you get what you want, but instead of that, I recommend you to make your own template, where you can define literally anything, according to your desires.
Edit: For the BlankActivity and a guide how to edit the other templates see this link:
How to change a BlankActivity template default files and a guide how to do it for any others.
in our course, we hacked the default activity. It worked as expected, still a side effect occured while upgrading from Android Studio 3 to 3.1.
The installation wizard detected the default activity template was modified and we had to replace our hacked version with a stock one.
So I suggest creating your own templates in the way Android Studio expects it (ie, through the template options) for a smooth upgrade process.
I've updated my eclipse and ADT Plugin from v22.3 to v22.6 recently and recognised some big changes. Whenever I create a new Android Application Project there appears a new appcompat_v7 library which wasn't present on v22.3 plugin and also a fragment_main.xml file which as I understand is meant to replace activity_main.xml file. Why is that? Why is the activity_main.xml file not preferred for activity layout directly anymore and why appcompat library is now included in every project as a necessity?
Is there a way to bring back the old way of creating projects without losing anything? By the way, I create projects compatible with Android versions from 2.2 to 4.4.
Fragment is useful for navigating through layouts of activity.for example if you have two different layout for portrait and landscape mode then you can simply navigate though the different fragments.
Secondly,
if you can not even get used to it,just remove the default code from activity_main.xml and and cut the fragment_layout.xml and paste it to activity_main.
Then delete the code related to fragment in MainActivity.java.Then delete the fragment_main.xml file.
Hope it will work.It worked for me.
I have a question about the hierarchical view of eclipse. With some projects my com.example.test packages suddenly split where normally it would be on one line instead of three. It looks like this:
Does anybody know why this happens?
How can I get the com.example.test on one line again?
Edit:
I want the package presentation to be hierarchical, I only want the com.example.test back on one line.
I finally found the answer. It isn't folding because on mac there are hidden files (.DS_Store) and eclipse doesn't ignore these files, so the folders are not empty.
To fix this you have to exclude the DS_Store out of your project:
Right click, Properties
Expand Resource and click onto Resource Filters
Click "Add"
Use these settings Filter type: Exclude all.
Applies to: Files
Click "All children (recursive)"
File and folder attributes: Name matches .DS_Store
If you have done this, your project will have normal hierarchal view with com.example.test.
Found the solution at: http://twigstechtips.blogspot.nl/2012/10/eclipse-ignore-certain-files-in-project.html
Tip: Use Android Studio, it works so much better!
In the Package Explorer "View Menu" (the down arrow), select "Package Presentation" > "Flat".
I added grid layout to my project at the start and eclipse added a bunch of stuff. Now, though I am not using this layout. I want to remove it.
I can see the following from my properties file:
target=android-18
android.library.reference.1=../gridlayout_v7
When I remove the line
android.library.reference.1=../gridlayout_v7
I get compile errors relating to my R.java class.
I cannot seem to find a proper way to remove this package. Anybody knows how to do this?
Thanks!
#Nightshadow please right click on project and select properties and then select android now you will able to see Library pane in below area from there you can remove grideview layout library