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 trialCecilia Williams
322 PointsWhere is Fun Facts Project, I need to import into Android Studio?
Where is (Fun Facts Project), I need to import into Android Studio?
5 Answers
Cecilia Williams
322 PointsI am taking Android Development for Beginners... The instructor mentioned the Project "Fun Facts"... and said after I downloaded Android Studio "Set up" that our project should look like his project... So now I am totally lost (I have not learned enough about programming to program it ourselves),,, because my project (xml file/design) looks nothing like the teacher's example of "Fun Facts Project"... So I assume there is a -IMPORT- for "Fun Facts" that goes along with this lesson, but I am unable to find it...
Steve Hunter
57,712 PointsOK - let me try to assist. In the beginning of this course, you start with "Getting Started with Android" - that does some intro work, then goes into a bit of Java stuff, intros the Android Studio then theres a segment called "Creating the Fun Facts Project". Is that where you are up to?
Cecilia Williams
322 Pointsyes..
Steve Hunter
57,712 PointsI'm following this video now to see what I get faced with when the project builds.
In the video, the projects lands in the xml view of activity_fun_facts.xml
- I'm not sure if that is normal behaviour so I'll see for myself and get back to you. (It's running a load of Gradle stuff right now).
I'll be back with you as soon as it's finished indexing and whatever else it wants to do!
Steve Hunter
57,712 PointsWhat have you got on your screen? Are you using Windows or Mac?
Cecilia Williams
322 PointsI am using mac... and the teacher has (only) activity xml... I have activity & content xml... and what the teacher has on (his) activity xml... is on (my) content xml...
Steve Hunter
57,712 PointsHi Cecilia,
Apologies for the delay - I had to go out. Back now for a little while.
I see your problem, yes. I have copied the contents of "content.xml" and replaced the content of activity.xml with that copy, ith the exclusion of the first line. So, I retained the first line of activity (that is about xml version encoding).
Then I have deleted content.xml.
Inside what is now activity.xml, there is a reference to showIn
- I have deleted that too.
Now, inside the java code, in FunFactsActivity.java
I have deleted a whole chunk of code. That may have ramifications later on - I don't know. But if you find open the Java folder on the left in the Project Explorer, find that file you will see a section of code that starts with protected void onCreate
. Delete all but the first two lines.
Leave this:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fun_facts);
// I DELETED A LOT OF CODE HERE!!
}
@Override
.
.
I think that leaves you in the same position as Ben Jakuben starts this project.
Shout if you need more help - I am around some of this evening and all day tomorrow. (I'm on UK time - nearly 7pm here now).
Steve.
Cecilia Williams
322 PointsSorry it took so long to get back to you...but what you said really helped... Again...Many Thanks...
Steve Hunter
57,712 PointsHey, no problem! As long as you got sorted, that's great.
Steve.
Cecilia Williams
322 PointsWhat are the best practices for what dependencies to set in android studio (library)
Steve Hunter
57,712 PointsI'm not best placed to answer that as I'm no expert. However, I'd say that there are some good tips to follow to ensure your project behaves as expected.
- Only import a dependency if it is needed
- Use explicit versioning so use compile "alibrary :12.3.2" rather than compile "alibrary : 12.+" That helps with consistent performance
- Select remote dependencies over local ones - this keeps your app nimble
There will be lots of different opinions out there, I am sure and many that I wouldn't be able to agree or disagree with through lack of knowledge!
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsHi Cecilia,
What is it you need here? The project files are usually downloadable from the bottom of the screen where the video is located. But, generally, you write the code yourself rather than relying on these projects files - they are more for when things go very wrong!
Sorry if I have misunderstood your question.
Steve.