1 package com.android.tests.basicProjectWithJava; 2 3 import com.android.tests.basicJavaProject.Foo; 4 5 import android.content.Context; 6 import android.util.AttributeSet; 7 import android.widget.TextView; 8 9 public class MyTextView extends TextView { 10 11 public MyTextView(Context context, AttributeSet attrs, int defStyle) { 12 super(context, attrs, defStyle); 13 14 Foo f = new Foo(); 15 setText("Foo: " + f.getRandomFoo()); 16 } 17 18 public MyTextView(Context context, AttributeSet attrs) { 19 super(context, attrs); 20 Foo f = new Foo(); 21 setText("Foo: " + f.getRandomFoo()); 22 } 23 24 public MyTextView(Context context) { 25 super(context); 26 } 27 } 28