我有这段代码,我想将int传递给此类:
if (content_timer.getChildCount() != 0) content_timer.removeAllViews();
content_timer.addView(new CircleTimer(getApplicationContext()));
然后我有“ new CircleTimer(getApplicationContext())”实例该类,但是我想在该类中传递一个值,我该怎么办?
最佳答案
if (content_timer.getChildCount() != 0) content_timer.removeAllViews();
content_timer.addView(new CircleTimer(getApplicationContext(),10));
^^^^^^
编辑课程
public class CircleTimer
{
int a;
public CircleTimer(Context cxt, int a) <------
{
this.a =a;
}
.....
}