Guest User

Untitled

a guest
Jun 27th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. /**
  2. * Displays text to the user.
  3. */
  4. public class TextView extends View {
  5.  
  6. // String value
  7. private String mText;
  8.  
  9. // Text color of the text
  10. private int mTextColor;
  11.  
  12. // Context of the app
  13. private Context mContext;
  14.  
  15. /**
  16. * Constructs a new TextView with initial values for text and text color.
  17. */
  18. public TextView(Context context) {
  19. mText = "";
  20. mTextColor = 0;
  21. mContext = context;
  22. }
  23.  
  24. /**
  25. * Sets the string value in the TextView.
  26. *
  27. * @param text is the updated string to be displayed.
  28. */
  29. public void setText(String text) {
  30. mText = text;
  31. }
  32.  
  33. /**
  34. * Sets the text color of the TextView.
  35. *
  36. * @param color of text to be displayed.
  37. */
  38. public void setTextColor(int color) {
  39. mTextColor = color;
  40. }
  41.  
  42. /**
  43. * Gets the string value in the TextView.
  44. *
  45. * @return current text in the TextView.
  46. */
  47. public String getText() {
  48. return mText;
  49. }
  50.  
  51. /**
  52. * Gets the text color of the TextView.
  53. *
  54. * @return current text color.
  55. */
  56. public int getTextColor() {
  57. return mTextColor;
  58. }
  59. }
Add Comment
Please, Sign In to add comment