• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Trouble with TextView Class

I can not seem to dynamical put variables on my app. text screen. Within my activity_main.xml file I have created an id like this -
[HIGH]<TextView
android:id="@+id/dataView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView2"
android:layout_marginLeft="36dp"
android:layout_toRightOf="@+id/textView5"
android:text="@string/planet_name_label" />[/HIGH]

I am trying to display "dataView1" within my MainActivity.java file like this -
[HIGH]TextView planetNameValue = (TextView)findViewById(R.id.dataView1);
planetNameValue.setText(earth.planetName);[/HIGH]

Everything complies but my dataView1 does not show up on app screen.
Thanks in advance.
 
Many possible reasons there. First try to replace "earth.planetName" with a string such as

planetNameValue.setText("test")

to see if your textview appears. If yes, your planetName content may be null. Print it out to check its content.
 
Back
Top Bottom