|
@@ -9,6 +9,7 @@ import java.util.HashMap;
|
|
|
|
|
|
import de.tudarmstadt.informatik.hostage.R;
|
|
|
import de.tudarmstadt.informatik.hostage.logging.DatabaseHandler;
|
|
|
+import de.tudarmstadt.informatik.hostage.logging.Record;
|
|
|
import de.tudarmstadt.informatik.hostage.logging.SQLLogger;
|
|
|
import android.annotation.SuppressLint;
|
|
|
import android.app.Activity;
|
|
@@ -283,14 +284,14 @@ public class ViewLog extends Activity {
|
|
|
}
|
|
|
|
|
|
private void setFirstAndLastAttack() {
|
|
|
- int firstAttackId = dbh.getSmallestAttackId();
|
|
|
- int lastAttackId = dbh.getHighestAttackId();
|
|
|
- if (firstAttackId != -1) {
|
|
|
- Date resultdate = new Date(dbh.getRecordOfAttackId(firstAttackId).getTimestamp());
|
|
|
+ Record firstAttack = dbh.getRecordOfAttackId(dbh.getSmallestAttackId());
|
|
|
+ Record lastAttack = dbh.getRecordOfAttackId(dbh.getHighestAttackId());
|
|
|
+ if (firstAttack != null) {
|
|
|
+ Date resultdate = new Date(firstAttack.getTimestamp());
|
|
|
TextView text = (TextView) findViewById(R.id.textFirstAttackValue);
|
|
|
text.setText(sdf.format(resultdate));
|
|
|
text = (TextView) findViewById(R.id.textLastAttackValue);
|
|
|
- resultdate = new Date(dbh.getRecordOfAttackId(lastAttackId).getTimestamp());
|
|
|
+ resultdate = new Date(lastAttack.getTimestamp());
|
|
|
text.setText(sdf.format(resultdate));
|
|
|
} else {
|
|
|
TextView text = (TextView) findViewById(R.id.textFirstAttackValue);
|