I am having trouble of setting my TextVIew in java using android studio -


my java class written

public class musicalactivity extends appcompatactivity {  private textview speedtextview; private textview pacetextview; private textview calburnttextview; private runnerinformation runnerinformation;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_musical);      speedtextview = (textview) findviewbyid(r.id.speed_text_view);     speedtextview.settext("current speed" + "6m/s");      pacetextview = (textview) findviewbyid(r.id.pace_text_view);     pacetextview.settext("current pace" + "60/min");      calburnttextview = (textview) findviewbyid(r.id.calburnt_text_view);     calburnttextview.settext("current calories burnt" + "1000"); } } 

and xml file like

<linearlayout android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:orientation="vertical"     xmlns:android="http://schemas.android.com/apk/res/android">      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:padding="24dp"         android:id="@+id/speed_text_view" />    <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:padding="24dp"         android:id="@+id/pace_text_view" />    <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:padding="24dp"         android:id="@+id/calburnt_text_view" />    </linearlayout> 

i try assign "current speed 6m/s" textview id speed_text_view nothing on it. furthermore, should if want assign dynamic text textview? speed dynamic , retrieved "runnerinformation"

in xml file, change linear layout height , width "wrap content" "match parent".


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -