Wednesday, April 17, 2013

[android help] Trying to set color to my text in android


I am trying to set color for my text in android. Every time i launch my application it shuts down. Here is what i have in color.xml file:





#006400
#FFE4C4


here is what i have in my MainActivity Class:



int textColor = getResources().getColor(R.color.app_text_color);

TextView helloText = (TextView)findViewById(R.string.hello_world);

helloText.setTextColor(textColor);


Here is the layout file:



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"
tools:context=".MainActivity" >

android:id="@+id/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
/>




Log Car:



04-17 21:00:39.290: E/AndroidRuntime(9986): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1670)


.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...