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

Android Build a Blog Reader Android App Using Intents to Display and Share Posts Opening a Webpage Within the App

Marc-Oliver Gern
Marc-Oliver Gern
8,747 Points

Opening a Webpage Within the App

I followed the video closely, but got stuck when I set up a new Activity. The .xml file was populated with way more code than shown in the video – which confused me a bit. The next BIG thing that made my app constantly crash was an error in the BlogWebViewActivity.java file. On line 27 I needed to replace ... (R.menu.activity_blog_web_view, menu) with (R.menu.blog_web_view, menu).

Not sure WHY? Any suggestions?

4 Answers

Do you have activity_blog_web_view file in menu folder? I'm not sure because I can't open android Studio right now, but I thought it would be without-"activity" version that lives in menu folder. In that case, it's useless to set activity_blog_web_view as "menu" layout. Ben should have replaced as you did, I supposed. As the matter of fact, he didn't press the menu button in emulater. If he had done that, the app would crash.

This is total guess, sorry. I'm not used to my new OS and have some issue myself on Android Studio.

Marc-Oliver Gern
Marc-Oliver Gern
8,747 Points

Hi Hiroki,

I am working in Eclipse. Android Studio might set up different files.

I bet they are almost same. I used eclipse longer than Android Studio, and when I changed to Android Studio, I didn't feel any difference in files.

Kevin Lavi
Kevin Lavi
3,311 Points

I'm stuck trying to understand this also. Eclipse also makes a separate Fragment layout for the BlogWebView. Reading through some forum posts says I should just remove the Fragment totally, but the extra code in BlogWebViewActivity.java (that's not shown in the video) connects to the fragment file made, so once I delete the fragment it creates an error in BlogWebViewActivity.java. I'm not sure if I should just keep the fragment and just let it be, or delete that code in BlogWebViewActivity.java, or run it through activity_blog_web_view.xml instead of the fragment. Not to mention I have no idea what to do with all of the extra code in the java file that Marc brought up.