title: TextView - detect if String exceeds available space
body: <p>Here is my layout</p>
  
  <pre><code>         RelativeLayout
               ImageView  iv1
               TextView  
                     toTheRightOf iv1
                     toTheEndOf   iv1
                     toTheLeftOf  iv2      
               ImageView  iv2
           RelativeLayout end
  </code></pre>
  
  <p>So TextView is sandwiched between two ImageViews. So everything is displaying exactly as it should. However sometimes the line in the TextView is too long and comes too close to second ImageView. Sometimes extending right into it.  I am not looking to change the layout or try to squeeze around anything.  What I want to do is detect when the length of the String is too long and change the content of the String to abbreviated version with fewer characters.  How can I tell if and when the String is too close to the ImageView? Sometimes there is room and sometimes not. This layout is for item in a RecyclerView - not that that really matters much as far as the question is concerned.  I know Android can detect when String is too long and add ... but what I am trying to do is rather than ... I want to simply change the String to one that has fewer characters.</p>
  
  <p>Perhaps I just need to decide how many characters is too many? But will this change by device resolution etc? Or will it be the same whether I am on a tablet or Galaxy Note, or smaller device?  I don't want a different layout per device just for this issue. I would rather just dynamically be able to check whether the string will take up too much room. In any event it's not really a layout change it's a string content change I am after.</p>
  
  <p>UPDATE: TO CLARIFY.</p>
  
  <p>Let's say the String is 'Thursday, December 19, 2017'
  If this is would take up too much room then I don't want to see
      'Thursday, December 19 ...'
  Rather I want to see that the String is too long and instead do </p>
  
  <pre><code>    tv.setText('12/19/2017');
  </code></pre>
  
  <p>I want to conditionally set the text value based on whether the given string takes up too much room.</p>