从(for循环)设置edittext?

时间:2015-03-01 20:29:21

标签: android

public class Calculater extends ActionBarActivity {
EditText gpa;
EditText hour;
int numberofhoures;
PlanDataBase plan_db;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_calculater);
    gpa=(EditText) findViewById(R.id.gpashow);
    hour=(EditText) findViewById(R.id.hoursshow);

    plan_db=new PlanDataBase(this);
    for(int hour=0;hour<plan_db.getallcorces().size();hour++){
        if(plan_db.getallcorces().get(hour).getcoursemark()!=0)
        {
            numberofhoures=numberofhoures+plan_db.getallcorces().get(hour).getcoursehour();
        }

    }

    hour.setText(String.valueOf(numberofhoures));

}

这是我的代码。 (小时)输出= 0取默认值,如何设置edittext(for循环)?

0 个答案:

没有答案
相关问题