java - Is there a way to set a variable's value to a TextView's text using XML in Android Studio? -


i writing little program android (i newbie java), , wonder if there's way set textview-text's value of public static double variable defined in corresponding .java file, using xml code, can dynamicresource in c#-xaml.

i have managed programatically set textview's text using

textview value1 = (textview) findviewbyid(r.id.textview1); value1.settext(string.valueof(myclass.staticvariableinmyclass)); 

but it, if possible, editing xml files of project, not need update textview's text anymore.

thanks in advance.

ways set text in textview : xml - add attribute textview element android:text="your text" . java:

textview tvid = (textview) findviewbyid(r.id.tv_id); tvid.settext("your text");

if have double variable convert this. string.valueof(double var);


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -