把数据库的数据放入一个传感器c1里面,然后再把c1存入list现在我想给airT_tv3的设置文本内容为数据库的第一行数据的airT的值,我要怎么写参数? public void run() {
list=new ArrayList<ChuanganqiInfo>();
Cursor currsor=db.query("nongye",null,null,null,null,null,null);
if(currsor.moveToFirst()){
do {
c1=new ChuanganqiInfo();
c1.setAirT(currsor.getInt(1));
c1.setAirH(currsor.getInt(2));
c1.setLight(currsor.getInt(3));
c1.setSoilT(currsor.getInt(4));
c1.setSoilH(currsor.getInt(5));
c1.setCo2(currsor.getInt(6));
list.add(c1);
}while (currsor.moveToNext());
}
//ChuanganqiInfo c1=new ChuanganqiInfo();
currsor.close();
airT_tv3.setText(list.get(j).toString());//设置文本在这里
j++;
if (j==currsor.getCount()){
j=0;
}
Toast.makeText(mContext,"刷新",Toast.LENGTH_SHORT).show();
handler.postDelayed(this,5000);
}
添加回答
举报
0/150
提交
取消