TestaActivity.java指定值到一個TextView從不同類
public class TestaActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tvText=(TextView)findViewById(R.id.textView1);
tvText.setText("Sample");
}
}
Print.java
public class Print {
public Print(Context tempContext) {
//I want to assign the value to the tvText from here
}
}
在上面的例子中,你可以看到我在tvText設置文本「樣品」。以同樣的方式,我需要在創建後在Print類中爲textView1 ID分配一些值。
請幫我找出辦法。