Into a layout I have a TextView
At runtime I need to be able to change the text of this TextView.
Here how I'm trying to do that
This result in an error
stFrom.setText(stationFrom);
Code:
<TextView
android:id="@+id/text_routes_details_station_from_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="@string/text_routes_details_station_from_value"
android:textAppearance="?android:attr/textAppearanceSmall" />
Here how I'm trying to do that
Code:
TextView stFrom = (TextView) findViewById(R.id.text_routes_details_station_from_value);
stFrom.setText(stationFrom); //stationFrom at the moment is an hardcoded string, so it has a value
line 25 is02-28 11:18:22.271: E/AndroidRuntime(369): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lcapps.testApp/com.lcapps.testApp.RouteDetailActivity}: java.lang.NullPointerException
....
02-28 11:18:22.271: E/AndroidRuntime(369): at com.lcapps.testApp.RouteDetailActivity.onCreate(RouteDetailActivity.java:25)
stFrom.setText(stationFrom);