Question: I am building a simple app that multiplies a number entered by the user by 5 and displays the result. Since, I am a beginner, I need some help with this.

Here's my HTML code: 

```
        <!DOCTYPE html>
    <head>
    <title>Area Calc</title>
       <link rel='stylesheet' type='text/css' href='style.css'/>
       <link href='http://fonts.googleapis.com/css?family=Titillium+Web' rel='stylesheet' type='text/css'>
       <link href='http://fonts.googleapis.com/css?family=Exo+2' rel='stylesheet' type='text/css'>
             <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
            <script type='text/javascript' src='script.js'></script>

            <head>
            <body>
            <div class="heading">Number Of Persons Calc</div>
         <div style=" color: white; text-align:auto; width:400px; margin-right:auto; margin-left:auto; border:1px solid white; margin-top: 120px;">
        <form method="" action="">
                <input type="text" name="area" placeholder="Enter in square metres!" class="input" />
                <input class="submit" type="submit" value="Submit" class="button" />

            </form>
            </div>
<body>
<html>

```

Can someone tell me what JavaScript/jQuery code could possibly take the value entered by the user from the text input element and multiply it by 5 and then display the result to the user? Please help me with this.

Answer: 
The basic idea is to use a method with an internal `ViewAction` that retrieves the text in its perform method. Anonymous classes can only access final fields, so we cannot just let it set a local variable of `getText()`, but instead an array of String is used to get the string out of the `ViewAction`.

```java
    String getText(final Matcher<View> matcher) {
        final String[] stringHolder = { null };
        onView(matcher).perform(new ViewAction() {
            @Override
            public Matcher<View> getConstraints() {
                return isAssignableFrom(TextView.class);
            }

            @Override
            public String getDescription() {
                return "getting text from a TextView";
            }

            @Override
            public void perform(UiController uiController, View view) {
                TextView tv = (TextView)view; //Save, because of check in getConstraints()
                stringHolder[0] = tv.getText().toString();
            }
        });
        return stringHolder[0];
    }

```

**Note:** This kind of view data retrievers should be used with care. If you are constantly finding yourself writing this kind of methods, there is a good chance, you're doing something wrong from the get go. Also don't ever access the View outside of a `ViewAssertion` or `ViewAction`, because only there it is made sure, that interaction is safe, as it is run from UI thread, and before execution it is checked, that no other interactions meddle.
If you want to check text value with another text, you can create Matcher. You can see my code to create your own method:

```
 public static Matcher<View> checkConversion(final float value){
    return new TypeSafeMatcher<View>() {

        @Override
        protected boolean matchesSafely(View item) {
            if(!(item instanceof TextView)) return false;

            float convertedValue = Float.valueOf(((TextView) item).getText().toString());
            float delta = Math.abs(convertedValue - value);

            return delta < 0.005f;
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("Value expected is wrong");
        }
    };
}

```