title: How to get the line of text clicked in a textview
body: <p>I have a text view with multiple lines of text e.g.</p>
  
  <p>This is line 1</p>
  
  <p>This is line 2</p>
  
  <p>This is line 3</p>
  
  <p>I want to be able to store the text depending on which line the user has clicked, i.e. if they click on line 2 I want to store "This is line 2".</p>
  
  <p>How can I go about this?</p>
  
  <p><strong>Edited 1 Sept:</strong></p>
  
  <p>I am not sure how the clickable span solution would work? I am able to get a specific line of text from my text view e.g. to get line 1 I would use:</p>
  
  <pre><code>TextView tv = (TextView) view.findViewById(R.id.class_list);
  String selectedClass =(String)(tv).getText();
  int l1start = tv.getLayout().getLineStart(1);
  int l1end = tv.getLayout().getLineEnd(1);
  String l1 = selectedClass.substring(l1start, l1end);
  </code></pre>
  
  <p>But I can't see how to work out which line number has actually been clicked by using clickable span?</p>