0
如何將項目添加到列表適配器,但是每次迭代n時,它都會添加到不同的列表和不同的適配器,謝謝!Dynamic將項目添加到不同列表和不同適配器的列表
//我的第一個代碼
int n = 1;
while (n != 16) {
Day(n, Fullname);
n +=1 ;
}
//另一種是將添加到列表和適配器
private void Day(int n,String Fullname){
String Date = "0" + n + "-" + Month + "-" + Year;
Cursor c = db.GetSpecific(Fullname,Date);
String allowancecount = "";
int intallowancecount = 0;
double totalCom = 0;
while(c.moveToNext()){
String serviceprice = c.getString(4);
String serviceperformedbynumber = c.getString(10);
allowancecount = c.getString(12);
intallowancecount = intallowancecount + Integer.parseInt(allowancecount.trim());
double income = Integer.parseInt(serviceprice.trim())/
Integer.parseInt(serviceperformedbynumber.trim());
totalCom = totalCom + income ;
//here what to do?
String add ="List" + n + ".add(String.valueOf(" + income + "));";
do add;//???????
}
//here what to do?
String Dynamic = "Com" + n + ".setText(String.valueOf(" + totalCom + "))";
do Dynamic ;//?????????
String Dynamicadapter = "Lv" + n + ".setAdapter(adapter" + n + ")";
do Dynamicadapter ;//????????
}
我只是想,如果這是可能的,但如果沒有,我會以我知道的另一種方式做到這一點,打開任何建議,再次感謝。
感謝的人的
map
..得到這個。 @Smittey – JMZ