New Line in InstructionStep & Video View

29 views
Skip to first unread message

Aidan Denny

unread,
Jun 11, 2019, 2:27:58 PM6/11/19
to ResearchStack
I recently started working on a ResearchStack port of a ResearchKit app, but I'm having trouble with a few text formatting issues. \n is not working correctly with InstructionStep, and does not output a new line character. I have tried troubleshooting by using <br/> as well as the xml codes for new line (&#xD; as well as &#xA;). Though I'm still unsure if it would work, I would prefer not to convert our 4000 line strings.xml document to a <[!CDATA[]] format. Any help is appreciated.

In addition, I'm wondering how to construct an InstructionStep that includes a video. I am relatively new to Android Studio, and am unsure how it could be implemented. I can see the ViewVideoActivity() class, but am unsure how to use it and add it to an instruction step. Thank you!

Aldo Israel NA

unread,
Apr 28, 2020, 4:06:57 PM4/28/20
to ResearchStack
I don't know how your strings are formatted but it should work this way:

<string name="your_string_id">First line\nSecond line</string>

</br> is for HTML content.

Another option could be:

yourString= yourString.replaceAll("\n", System.getProperty("line.separator"));


The other question its a little more difficult, you have to create your own InstructionStep Implementation:

public class YourInstructionStep extends Step {
 @Override
 public Class getStepLayoutClass() {
         // Here is your custom layout it should extend FrameLayout and implement StepLayout
         // This class must override the getContentResourceId() method to define the layout.
         // You can add whatever you want inside that layout.
        return YourInstructionStepLayout.class;
Reply all
Reply to author
Forward
0 new messages