質問編集履歴
1
情報の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -125,3 +125,75 @@
|
|
125
125
|
|
126
126
|
|
127
127
|
```
|
128
|
+
|
129
|
+
Helper派生クラス追記しときます
|
130
|
+
|
131
|
+
```lang-<java>
|
132
|
+
|
133
|
+
import android.content.Context;
|
134
|
+
|
135
|
+
import android.database.sqlite.SQLiteDatabase;
|
136
|
+
|
137
|
+
import android.database.sqlite.SQLiteOpenHelper;
|
138
|
+
|
139
|
+
import android.content.ContentValues;
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
public class SQLite extends SQLiteOpenHelper{
|
144
|
+
|
145
|
+
static final private String DBNAME = "test.sqlite";
|
146
|
+
|
147
|
+
static final private int VERSION = 1;
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
//コンストラクタ
|
154
|
+
|
155
|
+
public SQlite(Context context){
|
156
|
+
|
157
|
+
super(context, DBNAME, null, VERSION);
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
@Override
|
164
|
+
|
165
|
+
public void onOpen(SQLiteDatabase db){
|
166
|
+
|
167
|
+
super.onOpen(db);
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
@Override
|
174
|
+
|
175
|
+
public void onCreate(SQLiteDatabase db){
|
176
|
+
|
177
|
+
db.execSQL("CREATE TABLE test" +
|
178
|
+
|
179
|
+
"(id integer, spot integer, type integer,date date, usrmsg text, numgood integer)");
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
@Override
|
186
|
+
|
187
|
+
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
188
|
+
|
189
|
+
// TODO 自動生成されたメソッド・スタブ
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
}
|
198
|
+
|
199
|
+
```
|