0
我有,我抢到一个TextView normallythen我有一个单独的类这就是一个活动的情况下需要一个TextView的修改它如何抢在一个类中一个TextView通过活动
//textview
this.tvUpdate = (TextView) findViewById(R.id.tvUpdate);
new GetData(context,params,method,preText);
我想这个相同的视图在一个独立的类中,而不必在构造函数中传递它。
public class GetData {
private ProgressBar pbTitle;
private TextView tvUpdate;
private Context context;
private String preText,method;
private String[] params;
public void getData(Context context,String[] params, String method,String preText){
this.context = context;
//how do i get this text view?
this.tvUpdate = ???
this.params = params;
this.method = method;
}
}
不知道这是否可能。代码
tvUpdate = (TextView) ((Activity) context).findViewById(R.id.tvUpdate);
作品... – Brian
高兴它的工作.... – Rakhita
其实还是有一些问题。代码没有任何错误,但我无法操作视图。 – Brian