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 trialJoshua Schoen
900 PointsCode error I can't figure out, and I can't progress because of it. It's a java coding error in android studio.
<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:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="FunFacts" android:background="#ff4fff2b">
<TextView
android:text="Did you know?"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/"
android:textSize="26sp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/FunFactText"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:text="This course is awesome <3. "
android:textSize="22sp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Press for another AMAZING fact u didn't know"
android:id="@+id/MySwaggyButton"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:textSize="16sp"
android:background="@android:color/holo_blue_light" />
</RelativeLayout>
My java error:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fun_facts); }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.fun_facts, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Joshua Schoen
900 PointsIt doesn't say anything when I hover my mouse under it. I can't even figure out where it is; But when I added those phrases in the " design" Squiggly red lines started appearing in my src and java. I'm kind of new too this so, I have no idea what the problem actually is.
Gloria Dwomoh
13,116 PointsTry to run it and check for errors in the logcat. Then if you find the error paste it here. Try hovering your mouse in the squiggly red part in the source as well to see if it notes the error.
1 Answer
miguelcastro2
Courses Plus Student 6,573 PointsIf you do not know how to work with logcat then you will not be able to do the most necessary step in programming, which is debugging your code and tracking errors. I recommend you watch the videos on using Android Studio. I believe the very first track covers how to use logcat and basic debugging in good detail.
Gloria Dwomoh
13,116 PointsGloria Dwomoh
13,116 PointsWhat does the error say?