Showing
2 changed files
with
11 additions
and
1 deletions
| ... | @@ -35,7 +35,9 @@ public class FirstActivity extends AppCompatActivity { | ... | @@ -35,7 +35,9 @@ public class FirstActivity extends AppCompatActivity { |
| 35 | sql = "SELECT * FROM reports WHERE date=" + getTime + ";"; | 35 | sql = "SELECT * FROM reports WHERE date=" + getTime + ";"; |
| 36 | Cursor cursor = db.rawQuery(sql, null); | 36 | Cursor cursor = db.rawQuery(sql, null); |
| 37 | if (cursor.getCount() == 0) { | 37 | if (cursor.getCount() == 0) { |
| 38 | - sql = String.format("INSERT INTO reports VALUES('0','0','" + getTime + "');"); | 38 | + double dValue = Math.random(); |
| 39 | + int iValue = (int)(dValue * 100); | ||
| 40 | + sql = String.format("INSERT INTO reports VALUES('" + iValue + "','0','" + getTime + "');"); | ||
| 39 | db.execSQL(sql); | 41 | db.execSQL(sql); |
| 40 | } | 42 | } |
| 41 | } | 43 | } | ... | ... |
| 1 | package com.khuhacker.pocketgym; | 1 | package com.khuhacker.pocketgym; |
| 2 | 2 | ||
| 3 | +import android.content.Intent; | ||
| 3 | import android.database.Cursor; | 4 | import android.database.Cursor; |
| 4 | import android.database.sqlite.SQLiteDatabase; | 5 | import android.database.sqlite.SQLiteDatabase; |
| 5 | import android.graphics.Color; | 6 | import android.graphics.Color; |
| 6 | import android.os.Bundle; | 7 | import android.os.Bundle; |
| 7 | import android.util.Log; | 8 | import android.util.Log; |
| 9 | +import android.view.View; | ||
| 8 | import android.widget.TextView; | 10 | import android.widget.TextView; |
| 9 | 11 | ||
| 10 | 12 | ||
| ... | @@ -110,4 +112,10 @@ public class ReportActivity extends AppCompatActivity { | ... | @@ -110,4 +112,10 @@ public class ReportActivity extends AppCompatActivity { |
| 110 | lineChart.invalidate(); | 112 | lineChart.invalidate(); |
| 111 | } | 113 | } |
| 112 | 114 | ||
| 115 | + public void onClick(View view) { | ||
| 116 | + if(view.getId() == R.id.backBtn){ | ||
| 117 | + finish(); | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + | ||
| 113 | } | 121 | } | ... | ... |
-
Please register or login to post a comment