title: Android - how to use a custom TextView?
body: <p>I created a class that extends <code>TextView</code></p>
  
  <pre><code>public class EmployeeTextView extends TextView {
  
      private String employeeId;
  
      private String employeeName;
  
      public EmployeeTextView( Context context, String employeeId,
              String employeeName ) {
          super( context );
          this.employeeId = employeeId;
          this.employeeName = employeeName;
      }
  
      public String getEmployeeId( ) {
          return employeeId;
      }
  
      public void setEmployeeId( String employeeId ) {
          this.employeeId = employeeId;
      }
  
      public String getEmployeeName( ) {
          return employeeName;
      }
  
      public void setEmployeeName( String employeeName ) {
          this.employeeName = employeeName;
      }
  
      @Override
      public CharSequence getText( ) {
          return this.employeeId + " - " + this.employeeName;
      }
  
  }
  </code></pre>
  
  <p>How would I implement this class in my main activity? Do I have to create these "<code>EmployeeTextView</code>"s programmatically? Or is there a way to create a custom widget and add it via XML, then call my getter and setter on it?</p>
  
  <p>The reason I need this custom TextView is that I need to get the employeeId or employeeName individually. </p>
  
  <p>Thanks</p>