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

Harshay Raipancholi
seal-mask
.a{fill-rule:evenodd;}techdegree
Harshay Raipancholi
Python Development Techdegree Student 11,521 Points

Need Help with Android : eclipse emulator & graphical layout

Hi all,

I just completed the 1st stage in build a simple android app project. the last step before completion was adding the 'onclicklistner' code. But when I run the code the app does not appear on the emulator, but, in the window below it shows 'success' . Can any please help me with this ?

Additionally, the code (which is already inserted) I see in the videos is slightly different from the one I see on eclipse and when I try to expand the width in eclipse of a button to the width of the screen , it just stretches to 80% of the screen width but not completely, im not sure why ?

thanks & regards

2 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Hi Harshay!

I'm not sure what the problem might be for why your app isn't showing up. Can you answer a few questions for me? I recently updated the bundle and perhaps something is affecting how the project runs.

  • How are you running the app (what are you clicking on)?
  • Is the emulator already running when you try running the app?
  • What does show on the emulator? Are you ever able to get to the home screen?
  • If you get to the home screen, what happens if you try running the app from Eclipse again?

For the 2nd problem - newer versions of Eclipse than what we use in the video add additional padding in the layout files. You can leave it as is or remove the padding parameters from the XML directly:

In the RelativeLayout element, remove the four lines that set "padding":

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    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"
Harshay Raipancholi
seal-mask
.a{fill-rule:evenodd;}techdegree
Harshay Raipancholi
Python Development Techdegree Student 11,521 Points

Hi Ben ,

Thanks for your response. The first problem has been solved. The first three times I tried to run the application the response on the emulator was extremely slow. But then it later ran fine.

I Will try to implement and test the solutions you provided for the second problem.

Thanks very much !