• 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.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones