質問編集履歴

2

修正

2017/09/17 13:57

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -42,7 +42,27 @@
42
42
 
43
43
  ArrayList<ListItem> listItems = new ArrayList<>();
44
44
 
45
- ListAdapter adapter = new ListAdapter(this, 0, listItems);
45
+ ListAdapter adapter = new ListAdapter(this, 0, listItems){
46
+
47
+ @Override
48
+
49
+ public View getView(int pos, View convertView, ViewGroup parent) {
50
+
51
+ TextView textView = (TextView)findViewById(R.id.d1);
52
+
53
+ textView.setTypeface(Typeface.createFromAsset(getAssets(),"font.ttf"));
54
+
55
+
56
+
57
+ return super.getView(pos, convertView, parent);
58
+
59
+ }
60
+
61
+ };
62
+
63
+
64
+
65
+
46
66
 
47
67
 
48
68
 

1

訂正

2017/09/17 13:56

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,9 @@
24
24
 
25
25
  ```
26
26
 
27
+
28
+
27
- @Override
29
+ @Override
28
30
 
29
31
  protected void onCreate(Bundle savedInstanceState) {
30
32
 
@@ -46,7 +48,43 @@
46
48
 
47
49
 
48
50
 
51
+ QuizOpenHelper quizOpenHelper = new QuizOpenHelper(this);
52
+
53
+ SQLiteDatabase sqLiteDatabase = quizOpenHelper.getReadableDatabase();
54
+
55
+
56
+
57
+ String sql = "select quiz from quiz where _id between 1 and 50";
58
+
59
+
60
+
61
+ Cursor cursor = sqLiteDatabase.rawQuery(sql, null);
62
+
63
+ cursor.moveToFirst();
64
+
65
+ int i = 0;
66
+
67
+ boolean next = cursor.moveToFirst();
68
+
69
+ while (next){
70
+
71
+ quizs[i] = cursor.getString(cursor.getColumnIndex("quiz"));
72
+
73
+ i ++;
74
+
75
+ next = cursor.moveToNext();
76
+
77
+ }
78
+
79
+ cursor.close();
80
+
81
+ sqLiteDatabase.close();
82
+
83
+
84
+
85
+
86
+
49
- for (int c = 1; c < 51; c++) {
87
+ for (int c = 0; c < 50; c++) {
50
88
 
51
89
 
52
90
 
@@ -54,25 +92,9 @@
54
92
 
55
93
 
56
94
 
57
- QuizOpenHelper quizOpenHelper = new QuizOpenHelper(this);
58
-
59
- SQLiteDatabase sqLiteDatabase = quizOpenHelper.getReadableDatabase();
60
95
 
61
96
 
62
-
63
- String sql = "select quiz from quiz where _id =" + c;
64
-
65
-
66
-
67
- Cursor cursor = sqLiteDatabase.rawQuery(sql, null);
68
-
69
- cursor.moveToFirst();
70
-
71
-
72
-
73
- quiz = cursor.getString(cursor.getColumnIndex("quiz"));
74
-
75
- listItem.setText(quiz);
97
+ listItem.setText(quizs[c]);
76
98
 
77
99
 
78
100
 
@@ -102,8 +124,6 @@
102
124
 
103
125
  }
104
126
 
105
-
106
-
107
127
  }
108
128
 
109
129
  コード