質問編集履歴
4
内容の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
-
String[] columns = {"id", "foodName", "foodgram"
|
49
|
+
String[] columns = {"id", "foodName", "foodgram"};
|
50
50
|
|
51
51
|
Cursor cursor = db.query("Products", columns, null, null, null, null, null);
|
52
52
|
|
@@ -62,19 +62,11 @@
|
|
62
62
|
|
63
63
|
double foodgram = cursor.getDouble(2);
|
64
64
|
|
65
|
-
double calorie = cursor.getDouble(3);
|
66
|
-
|
67
|
-
double protain = cursor.getDouble(4);
|
68
|
-
|
69
|
-
double carbon = cursor.getDouble(5);
|
70
|
-
|
71
|
-
double fat = cursor.getDouble(6);
|
72
|
-
|
73
65
|
|
74
66
|
|
75
67
|
products.add(
|
76
68
|
|
77
|
-
new Product(id, foodName, foodgram
|
69
|
+
new Product(id, foodName, foodgram)
|
78
70
|
|
79
71
|
);
|
80
72
|
|
3
内容の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,6 +38,8 @@
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
+
//データベースを読み込む
|
42
|
+
|
41
43
|
products = new ArrayList<Product>();
|
42
44
|
|
43
45
|
SQLiteDatabase db = helper.getReadableDatabase();
|
@@ -47,8 +49,6 @@
|
|
47
49
|
String[] columns = {"id", "foodName", "foodgram", "calorie", "protain", "carbon", "fat"};
|
48
50
|
|
49
51
|
Cursor cursor = db.query("Products", columns, null, null, null, null, null);
|
50
|
-
|
51
|
-
|
52
52
|
|
53
53
|
|
54
54
|
|
2
内容の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -35,6 +35,50 @@
|
|
35
35
|
public void onResume(){
|
36
36
|
|
37
37
|
super.onResume();
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
products = new ArrayList<Product>();
|
42
|
+
|
43
|
+
SQLiteDatabase db = helper.getReadableDatabase();
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
String[] columns = {"id", "foodName", "foodgram", "calorie", "protain", "carbon", "fat"};
|
48
|
+
|
49
|
+
Cursor cursor = db.query("Products", columns, null, null, null, null, null);
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
while(cursor.moveToNext()) {
|
56
|
+
|
57
|
+
int id = cursor.getInt(0) ;
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
String foodName = cursor.getString(1);
|
62
|
+
|
63
|
+
double foodgram = cursor.getDouble(2);
|
64
|
+
|
65
|
+
double calorie = cursor.getDouble(3);
|
66
|
+
|
67
|
+
double protain = cursor.getDouble(4);
|
68
|
+
|
69
|
+
double carbon = cursor.getDouble(5);
|
70
|
+
|
71
|
+
double fat = cursor.getDouble(6);
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
products.add(
|
76
|
+
|
77
|
+
new Product(id, foodName, foodgram, calorie, protain, carbon, fat)
|
78
|
+
|
79
|
+
);
|
80
|
+
|
81
|
+
}
|
38
82
|
|
39
83
|
|
40
84
|
|
1
タイトルの修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ArrayAdapter(ArrayList)を昇順にソートし
|
1
|
+
SQLiteに登録された情報をArrayAdapter(ArrayList)を用いて昇順にソートして表示
|
test
CHANGED
File without changes
|