Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Payton Dwight](https://uploads.teamtreehouse.com/production/profile-photos/3596152/micro_thethinker.jpg)
Payton Dwight
5,751 PointsNew Empty Activity Warnings
I googled around a bit and was unsuccessful. Another treehouse student had the same problem, but his question never got answered: https://teamtreehouse.com/community/warning-when-creating-an-empty-activity-what-does-it-mean
I tried to rebuild. I tried changing my dimens.xml before creating a new activity like so:
<dimen name="activity_horizontal_margin">16dp</dimen>
(because it seems like this is the culprit?). And I fiddled around with the activity_daily_forecast.xml (deleting the margins) to no avail.
Please help!
Thanks in advance.
![Payton Dwight](https://uploads.teamtreehouse.com/production/profile-photos/3596152/micro_thethinker.jpg)
Payton Dwight
5,751 PointsSweet, thanks Ben. I performed "undo" and "safe delete" on a few of the new empty activities (DailyForecastActivity) I created whilst trying to troubleshoot. I hope this didn't mess up anything behind the scenes.
2 Answers
![Payton Dwight](https://uploads.teamtreehouse.com/production/profile-photos/3596152/micro_thethinker.jpg)
Payton Dwight
5,751 PointsThis was the issue the whole time:
import pmdparadox.com.stormy.R;
was not present...
ah! Thanks, Ben.
![Ben Jakuben](https://secure.gravatar.com/avatar/ed792ef7584207802b7556057724fe13?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ben Jakuben
Treehouse TeacherAh! Missing import statement are the wooorst!
![Gwinyai Nyatsoka](https://secure.gravatar.com/avatar/255ee88b2533781c9c9b515b29ef3ea7?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Gwinyai Nyatsoka
7,428 PointsThis was the correct solution. I wonder why it forgets to import that file when the Activity is created.
![Ben Jakuben](https://secure.gravatar.com/avatar/ed792ef7584207802b7556057724fe13?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ben Jakuben
Treehouse TeacherOkay, I haven't seen this error before and did a little digging. I was able to recreate the warning very easily. I chose to ignore the warning and keep the files, and these are working (here are my dimens.xml and layout files):
dimens.xml
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">32dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
activity_daily_forecast.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_test_forecast"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="teamtreehouse.com.stormy.ui.TestForecastActivity">
</RelativeLayout>
Notice that my default dimens.xml file has a comment about default screen margins per the Android Design guidelines. I couldn't find specific guidelines for margins with a little bit of digging in the design guidelines.
I did find a reference in JetBrain's code to this type of warning. See line 128 here: https://github.com/JetBrains/android/blob/master/android/src/com/android/tools/idea/templates/RecipeMergeUtils.java
It looks like Android Studio is checking for values against some guidelines, but that the guidelines were updated and Android Studio is now throwing a warning for this difference. I'm not sure if 16dp
or 32dp
is the recommended margin at this point, but it doesn't really matter. I'll stick with 32dp
since that's the new default.
Let me know if you're having any trouble with the code itself, but this should be safe to ignore!
Ben Jakuben
Treehouse TeacherBen Jakuben
Treehouse TeacherI'm in the process of refreshing this course to avoid these types of issues. Sorry for the trouble! I'm currently away from my computer but I can take a look at this issue first thing tomorrow morning.