Get Text of Component

Is there anyway to get text of the component gave

is that

view1.getText

2 Likes

Yes, you can read the docs here :

https://developer.android.com/reference/android/widget/TextView#getText()

Sorry for going off-topic

Something like this should work:

String input = view1.getText().toString();
2 Likes

once again you helped thanks a lot :star_struck: now i coded as

@SimpleFunction(description = "texty")
public void set_text_colour(int color,AndroidViewComponent component) {
//YOUR ACTIVITY HERE
TextView view1 = (TextView)component.getView();
SpannableString sp1 = new SpannableString(view1.getText().toString());
sp1.setSpan(
new ForegroundColorSpan(color),
0,
sp1.length(),
0);
view1.setText (sp1);
}

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.