GyuhoLee

[Update] DB insert num, onClick

......@@ -35,7 +35,9 @@ public class FirstActivity extends AppCompatActivity {
sql = "SELECT * FROM reports WHERE date=" + getTime + ";";
Cursor cursor = db.rawQuery(sql, null);
if (cursor.getCount() == 0) {
sql = String.format("INSERT INTO reports VALUES('0','0','" + getTime + "');");
double dValue = Math.random();
int iValue = (int)(dValue * 100);
sql = String.format("INSERT INTO reports VALUES('" + iValue + "','0','" + getTime + "');");
db.execSQL(sql);
}
}
......
package com.khuhacker.pocketgym;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
......@@ -110,4 +112,10 @@ public class ReportActivity extends AppCompatActivity {
lineChart.invalidate();
}
public void onClick(View view) {
if(view.getId() == R.id.backBtn){
finish();
}
}
}
......