私は現在、スケジュールを計算するのを待っている間に進行状況をユーザーに通知するために、進行状況バーをプログラムに実装する方法を理解しようとして問題に直面しています。これは私のコーディングの重要な部分です。
Button btnOp1 = (Button) findViewById(R.id.btnOption1);
btnOp1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
int year1 = datePicker.getYear();
int mnth1 = datePicker.getMonth() + 1;
int dy1 = datePicker.getDayOfMonth();
int hr1 = timePicker.getCurrentHour();
int min1 = timePicker.getCurrentMinute();
fDate1 = (pad(year1)) + ("-") + (pad(mnth1))
+ ("-") + (pad(dy1));
fTime = (pad(hr1)) + (":") + (pad(min1));
ScheduleOp1();
}
private Object pad(int b) {
// TODO Auto-generated method stub
if (b >= 10){
return String.valueOf(b);
}else{
return "0" + String.valueOf(b);
}
}
});
protected void ScheduleOp1() {
// TODO Auto-generated method stub
Cursor cur = null;
boolean mustCont = true;
while (mustCont){
db.execSQL("DROP VIEW IF EXISTS " +view_Schedule1);
db.execSQL("CREATE VIEW " +view_Schedule1+ " " +
" AS SELECT " +sBusDepart+ "," +sBusArrival+ ","
+sBusDepartT+ "," +sBusArrivalT+ " FROM" + " "
+fDepart+ " " + "INNER JOIN" + " " +sBusSchedule+ " " +
"ON " +sBusSchedule+ "." +sBusDate+ "=" +fDepart+ "."
+fDate+ " " + "WHERE " +fDate+ "= '" +fDate1+"'"+" "+
"AND" + " " +sBusDepartT+ " " + "= strftime('%H:%M', '" +fTime+ "', '" +getVarMin()+"');");
cur = fetchAllTodos();
if (cur.getCount() == 0){
switch (min){
case 140 :
min = 141;
break;
case 141 :
min = 142;
break;
case 142 :
min = 143;
break;
case 143 :
min = 144;
break;
case 144 :
min = 145;
break;
case 145 :
min = 146;
break;
case 146 :
min = 147;
break;
case 147 :
min = 148;
break;
case 148 :
min = 149;
break;
case 149:
min = 150;
break;
case 150 :
min = 151;
break;
case 151 :
min = 152;
break;
case 152 :
min = 153;
break;
case 153 :
min = 154;
break;
case 154 :
min = 155;
break;
case 155 :
min = 156;
break;
case 156 :
min = 157;
break;
case 157 :
min = 158;
break;
case 158 :
min = 159;
break;
case 159 :
min = 160;
break;
case 160 :
min = 161;
break;
case 161 :
min = 162;
break;
case 162 :
min = 163;
break;
case 163 :
min = 164;
break;
case 164 :
min = 165;
break;
case 165 :
min = 166;
break;
case 166 :
min = 167;
break;
case 167 :
min = 168;
break;
case 168 :
min = 169;
break;
case 169 :
min = 170;
break;
case 170 :
min = 171;
break;
case 171 :
min = 172;
break;
case 172 :
min = 173;
break;
case 173 :
min = 174;
break;
case 174 :
min = 175;
break;
case 175 :
min = 176;
break;
case 176 :
min = 177;
break;
case 177 :
min = 178;
break;
case 178 :
min = 179;
break;
case 179 :
min = 180;
break;
case 180 :
min = 181;
break;
case 181 :
min = 182;
break;
case 182 :
min = 183;
break;
case 183 :
min = 184;
break;
case 184 :
min = 185;
break;
case 185 :
min = 186;
break;
case 186 :
min = 187;
break;
case 187 :
min = 188;
break;
case 188 :
min = 189;
break;
case 189 :
min = 190;
break;
case 190 :
min = 191;
break;
case 191 :
min = 192;
break;
case 192 :
min = 193;
break;
case 193 :
min = 194;
break;
case 194 :
min = 195;
break;
case 195 :
min = 196;
break;
case 196 :
min = 197;
break;
case 197 :
min = 198;
break;
case 198 :
min = 199;
break;
case 199 :
min = 200;
break;
case 200 :
min = 201;
break;
case 201 :
min = 202;
break;
case 202 :
min = 203;
break;
case 203 :
min = 204;
break;
case 204 :
min = 205;
break;
case 205:
min = 206;
break;
case 206 :
min = 207;
break;
case 207 :
min = 208;
break;
case 208 :
min = 209;
break;
case 209 :
min = 210;
break;
case 210 :
mustCont = false;
break;
}
}else{
mustCont = false;
min = 140;
}
}
if(cur != null && cur.getCount()>0){
cur.moveToFirst();
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle("Schedule Option 1 was chosen !")
.setMessage("Based on the flight time chosen, the latest SkyBus available to take from"+ " " +cur.getString(0)+ " "
+ "is"+ " " +cur.getString(2)+ " " + "which arrives at" + " "
+cur.getString(1)+ " " + "at" + " " +cur.getString(3)+ ".")
.setCancelable(false)
.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int but) {
dialog.cancel();
}
});
dialog.show();
dialog.create();
}else {
min = 140;
Toast.makeText(this, "Flight Schedule not found !", Toast.LENGTH_LONG).show();
}
}
助言がありますか?皆さんが私を助けてくれることを願っています。私はこれに精通していないので、コードを貼り付けてこれを実装する方法を示すことができれば便利です。= /