private void infoss() {
final Calendar c = Calendar.getInstance();// 獲取當前系統日期
int mYear = c.get(Calendar.YEAR);// 獲取年份
int mMonth = c.get(Calendar.MONTH);// 獲取月份
int mDay = c.get(Calendar.DAY_OF_MONTH);// 獲取天數
//updateDisplay();// 顯示當前系統時間
double[] str_monryInfos =new double[50];// 定義字串陣列,用來存盤支出資訊
String[] str_timeInfos=new String[50];
OutaccountDAO outinfo = new OutaccountDAO(Outaccountinfo.this);// 創建OutaccountDAO物件
// 獲取所有支出資訊,并存盤到List泛型集合中
List<Tb_outaccount> listoutinfos = outinfo.getScrollData(0, (int) outinfo.getCount());
//strmonryInfos = new double[listoutinfos.size()];// 設定字串陣列的長度
//strtimeInfos=new String[listoutinfos.size()];
int i = 0;// 定義一個開始標識
for (Tb_outaccount tb_outaccount : listoutinfos) {// 遍歷List泛型集合
// 將支出相關資訊組合成一個字串,存盤到字串陣列的相應位置
str_monryInfos[i] = tb_outaccount.getMoney();
str_timeInfos[i]= tb_outaccount.getTime();
i++;// 標識加1
}
int[] strmonth=new int[50];
int[] strday=new int[50];
for(int j=0;j<str_timeInfos.length;j++){
String[] str=str_timeInfos[j].split("-");
for(int m=0;m<3;m++){
int a=Integer.parseInt(str[i]);
if(m==1){
strmonth[j]=a;
}
if(m==2){
strday[j]=a;
}
}
}
double sum_month=0;
for(int s=0;s<str_timeInfos.length;s++){
if(mMonth==strmonth[s]){
sum_month=sum_month+str_monryInfos[s];
}
}
if(sum_month==500){
send("5554","您當月的支出已達到上線500元");
}
double sum_day=0;
for(int s=0;s<str_timeInfos.length;s++){
if(mDay==strmonth[s]){
sum_day=sum_day+str_monryInfos[s];
}
}
if(sum_day==50){
send("5554","您當天的支出已達到上線50元");
}
uj5u.com熱心網友回復:
陣列越界了 看看你代碼那塊范圍有問題轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/132671.html
標籤:Android
上一篇:小程式自帶的轉發功能
