質問編集履歴
4
内容の修正
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
products = new ArrayList<Product>();
|
|
23
23
|
SQLiteDatabase db = helper.getReadableDatabase();
|
|
24
24
|
|
|
25
|
-
String[] columns = {"id", "foodName", "foodgram"
|
|
25
|
+
String[] columns = {"id", "foodName", "foodgram"};
|
|
26
26
|
Cursor cursor = db.query("Products", columns, null, null, null, null, null);
|
|
27
27
|
|
|
28
28
|
while(cursor.moveToNext()) {
|
|
@@ -30,13 +30,9 @@
|
|
|
30
30
|
|
|
31
31
|
String foodName = cursor.getString(1);
|
|
32
32
|
double foodgram = cursor.getDouble(2);
|
|
33
|
-
double calorie = cursor.getDouble(3);
|
|
34
|
-
double protain = cursor.getDouble(4);
|
|
35
|
-
double carbon = cursor.getDouble(5);
|
|
36
|
-
double fat = cursor.getDouble(6);
|
|
37
33
|
|
|
38
34
|
products.add(
|
|
39
|
-
new Product(id, foodName, foodgram
|
|
35
|
+
new Product(id, foodName, foodgram)
|
|
40
36
|
);
|
|
41
37
|
}
|
|
42
38
|
|
3
内容の修正
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
public void onResume(){
|
|
19
19
|
super.onResume();
|
|
20
20
|
|
|
21
|
+
//データベースを読み込む
|
|
21
22
|
products = new ArrayList<Product>();
|
|
22
23
|
SQLiteDatabase db = helper.getReadableDatabase();
|
|
23
24
|
|
|
24
25
|
String[] columns = {"id", "foodName", "foodgram", "calorie", "protain", "carbon", "fat"};
|
|
25
26
|
Cursor cursor = db.query("Products", columns, null, null, null, null, null);
|
|
26
27
|
|
|
27
|
-
|
|
28
28
|
while(cursor.moveToNext()) {
|
|
29
29
|
int id = cursor.getInt(0) ;
|
|
30
30
|
|
2
内容の修正
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -18,6 +18,28 @@
|
|
|
18
18
|
public void onResume(){
|
|
19
19
|
super.onResume();
|
|
20
20
|
|
|
21
|
+
products = new ArrayList<Product>();
|
|
22
|
+
SQLiteDatabase db = helper.getReadableDatabase();
|
|
23
|
+
|
|
24
|
+
String[] columns = {"id", "foodName", "foodgram", "calorie", "protain", "carbon", "fat"};
|
|
25
|
+
Cursor cursor = db.query("Products", columns, null, null, null, null, null);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
while(cursor.moveToNext()) {
|
|
29
|
+
int id = cursor.getInt(0) ;
|
|
30
|
+
|
|
31
|
+
String foodName = cursor.getString(1);
|
|
32
|
+
double foodgram = cursor.getDouble(2);
|
|
33
|
+
double calorie = cursor.getDouble(3);
|
|
34
|
+
double protain = cursor.getDouble(4);
|
|
35
|
+
double carbon = cursor.getDouble(5);
|
|
36
|
+
double fat = cursor.getDouble(6);
|
|
37
|
+
|
|
38
|
+
products.add(
|
|
39
|
+
new Product(id, foodName, foodgram, calorie, protain, carbon, fat)
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
21
43
|
String[] items = new String[products.size()];
|
|
22
44
|
|
|
23
45
|
for(int i = 0; i < products.size(); i++) {
|
1
タイトルの修正
title
CHANGED
|
@@ -1,1 +1,1 @@
|
|
|
1
|
-
ArrayAdapter(ArrayList)を昇順にソートし
|
|
1
|
+
SQLiteに登録された情報をArrayAdapter(ArrayList)を用いて昇順にソートして表示
|
body
CHANGED
|
File without changes
|