質問編集履歴
4
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -152,234 +152,234 @@
|
|
152
152
|
|
153
153
|
```
|
154
154
|
|
155
|
+
|
156
|
+
|
155
157
|
いちおうManifest.xmlです。
|
156
158
|
|
159
|
+
```xml
|
160
|
+
|
161
|
+
<?xml version="1.0" encoding="utf-8"?>
|
162
|
+
|
163
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
164
|
+
|
165
|
+
xmlns:tools="http://schemas.android.com/tools"
|
166
|
+
|
167
|
+
package="com.example.xxxxx.sqlite03">
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<application
|
172
|
+
|
173
|
+
android:allowBackup="true"
|
174
|
+
|
175
|
+
android:icon="@mipmap/ic_launcher"
|
176
|
+
|
177
|
+
android:label="@string/app_name"
|
178
|
+
|
179
|
+
android:roundIcon="@mipmap/ic_launcher_round"
|
180
|
+
|
181
|
+
android:supportsRtl="true"
|
182
|
+
|
183
|
+
android:theme="@style/AppTheme"
|
184
|
+
|
185
|
+
tools:ignore="GoogleAppIndexingWarning">
|
186
|
+
|
187
|
+
<activity android:name=".MainActivity">
|
188
|
+
|
189
|
+
<intent-filter>
|
190
|
+
|
191
|
+
<action android:name="android.intent.action.MAIN" />
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<category android:name="android.intent.category.LAUNCHER" />
|
196
|
+
|
197
|
+
</intent-filter>
|
198
|
+
|
199
|
+
</activity>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<activity android:name=".AddItemActivity"></activity>
|
204
|
+
|
205
|
+
<activity android:name=".CalculatorActivity"></activity>
|
206
|
+
|
207
|
+
<activity android:name=".ItemsSeeActivity"></activity>
|
208
|
+
|
209
|
+
<activity android:name=".RegiActivity"></activity>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
</application>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
</manifest>
|
218
|
+
|
219
|
+
```
|
220
|
+
|
157
221
|
|
158
222
|
|
159
|
-
MainActivity
|
160
|
-
|
161
|
-
```
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
223
|
+
MainActivity
|
224
|
+
|
225
|
+
```java
|
226
|
+
|
227
|
+
import android.content.ContentValues;
|
228
|
+
|
229
|
+
import android.content.Intent;
|
230
|
+
|
231
|
+
import android.support.v7.app.AppCompatActivity;
|
232
|
+
|
233
|
+
import android.os.Bundle;
|
234
|
+
|
235
|
+
import android.database.Cursor;
|
236
|
+
|
237
|
+
import android.database.sqlite.SQLiteDatabase;
|
238
|
+
|
239
|
+
import android.view.View;
|
240
|
+
|
241
|
+
import android.widget.Button;
|
242
|
+
|
243
|
+
import android.widget.EditText;
|
244
|
+
|
245
|
+
import android.widget.TextView;
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
public class MainActivity extends AppCompatActivity {
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
private TextView textView;
|
254
|
+
|
255
|
+
private TestOpenHelper helper;
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
@Override
|
260
|
+
|
261
|
+
protected void onCreate(Bundle savedInstanceState) {
|
262
|
+
|
263
|
+
super.onCreate(savedInstanceState);
|
264
|
+
|
265
|
+
setContentView(R.layout.activity_main);
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
// DB作成
|
272
|
+
|
273
|
+
helper = new TestOpenHelper(getApplicationContext());
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
// // 変数textViewに表示するテキストビューのidを格納
|
278
|
+
|
279
|
+
// textView = findViewById(R.id.text_view);
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
// 商品登録
|
284
|
+
|
285
|
+
Button addItemBtn = findViewById(R.id.addItemBtn);
|
286
|
+
|
287
|
+
addItemBtn.setOnClickListener(new View.OnClickListener() {
|
288
|
+
|
289
|
+
@Override
|
290
|
+
|
291
|
+
public void onClick(View view) {
|
292
|
+
|
293
|
+
//インテントの作成
|
294
|
+
|
295
|
+
Intent intent = new Intent(getApplication(), AddItemActivity.class);
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
//遷移先の画面を起動
|
300
|
+
|
301
|
+
startActivity(intent);
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
});
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
// 商品確認
|
310
|
+
|
311
|
+
Button seeBtn = findViewById(R.id.seeBtn);
|
312
|
+
|
313
|
+
seeBtn.setOnClickListener(new View.OnClickListener() {
|
314
|
+
|
315
|
+
@Override
|
316
|
+
|
317
|
+
public void onClick(View view) {
|
318
|
+
|
319
|
+
Intent intent = new Intent(getApplication(), ItemsSeeActivity.class);
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
startActivity(intent);
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
});
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
// レジ買い物
|
332
|
+
|
333
|
+
Button RegiBtn = findViewById(R.id.RegiBtn);
|
334
|
+
|
335
|
+
RegiBtn.setOnClickListener(new View.OnClickListener() {
|
336
|
+
|
337
|
+
@Override
|
338
|
+
|
339
|
+
public void onClick(View view) {
|
340
|
+
|
341
|
+
Intent intent = new Intent(getApplication(), RegiActivity.class);
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
startActivity(intent);
|
346
|
+
|
347
|
+
}
|
348
|
+
|
349
|
+
});
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
// 電卓
|
354
|
+
|
355
|
+
Button calculatorBtn = findViewById(R.id.calculatorBtn);
|
356
|
+
|
357
|
+
calculatorBtn.setOnClickListener(new View.OnClickListener() {
|
358
|
+
|
359
|
+
@Override
|
360
|
+
|
361
|
+
public void onClick(View view) {
|
362
|
+
|
363
|
+
Intent intent = new Intent(getApplication(), CalculatorActivity.class);
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
startActivity(intent);
|
368
|
+
|
369
|
+
}
|
370
|
+
|
371
|
+
});
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
}
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
}
|
220
384
|
|
221
385
|
```
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
```java
|
226
|
-
|
227
|
-
import android.content.ContentValues;
|
228
|
-
|
229
|
-
import android.content.Intent;
|
230
|
-
|
231
|
-
import android.support.v7.app.AppCompatActivity;
|
232
|
-
|
233
|
-
import android.os.Bundle;
|
234
|
-
|
235
|
-
import android.database.Cursor;
|
236
|
-
|
237
|
-
import android.database.sqlite.SQLiteDatabase;
|
238
|
-
|
239
|
-
import android.view.View;
|
240
|
-
|
241
|
-
import android.widget.Button;
|
242
|
-
|
243
|
-
import android.widget.EditText;
|
244
|
-
|
245
|
-
import android.widget.TextView;
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
public class MainActivity extends AppCompatActivity {
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
private TextView textView;
|
254
|
-
|
255
|
-
private TestOpenHelper helper;
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
@Override
|
260
|
-
|
261
|
-
protected void onCreate(Bundle savedInstanceState) {
|
262
|
-
|
263
|
-
super.onCreate(savedInstanceState);
|
264
|
-
|
265
|
-
setContentView(R.layout.activity_main);
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
// DB作成
|
272
|
-
|
273
|
-
helper = new TestOpenHelper(getApplicationContext());
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
// // 変数textViewに表示するテキストビューのidを格納
|
278
|
-
|
279
|
-
// textView = findViewById(R.id.text_view);
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
// 商品登録
|
284
|
-
|
285
|
-
Button addItemBtn = findViewById(R.id.addItemBtn);
|
286
|
-
|
287
|
-
addItemBtn.setOnClickListener(new View.OnClickListener() {
|
288
|
-
|
289
|
-
@Override
|
290
|
-
|
291
|
-
public void onClick(View view) {
|
292
|
-
|
293
|
-
//インテントの作成
|
294
|
-
|
295
|
-
Intent intent = new Intent(getApplication(), AddItemActivity.class);
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
//遷移先の画面を起動
|
300
|
-
|
301
|
-
startActivity(intent);
|
302
|
-
|
303
|
-
}
|
304
|
-
|
305
|
-
});
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
// 商品確認
|
310
|
-
|
311
|
-
Button seeBtn = findViewById(R.id.seeBtn);
|
312
|
-
|
313
|
-
seeBtn.setOnClickListener(new View.OnClickListener() {
|
314
|
-
|
315
|
-
@Override
|
316
|
-
|
317
|
-
public void onClick(View view) {
|
318
|
-
|
319
|
-
Intent intent = new Intent(getApplication(), ItemsSeeActivity.class);
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
startActivity(intent);
|
324
|
-
|
325
|
-
}
|
326
|
-
|
327
|
-
});
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
// レジ買い物
|
332
|
-
|
333
|
-
Button RegiBtn = findViewById(R.id.RegiBtn);
|
334
|
-
|
335
|
-
RegiBtn.setOnClickListener(new View.OnClickListener() {
|
336
|
-
|
337
|
-
@Override
|
338
|
-
|
339
|
-
public void onClick(View view) {
|
340
|
-
|
341
|
-
Intent intent = new Intent(getApplication(), RegiActivity.class);
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
startActivity(intent);
|
346
|
-
|
347
|
-
}
|
348
|
-
|
349
|
-
});
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
// 電卓
|
354
|
-
|
355
|
-
Button calculatorBtn = findViewById(R.id.calculatorBtn);
|
356
|
-
|
357
|
-
calculatorBtn.setOnClickListener(new View.OnClickListener() {
|
358
|
-
|
359
|
-
@Override
|
360
|
-
|
361
|
-
public void onClick(View view) {
|
362
|
-
|
363
|
-
Intent intent = new Intent(getApplication(), CalculatorActivity.class);
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
startActivity(intent);
|
368
|
-
|
369
|
-
}
|
370
|
-
|
371
|
-
});
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
}
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
}
|
384
|
-
|
385
|
-
```
|
3
mainactivity
test
CHANGED
File without changes
|
test
CHANGED
@@ -152,10 +152,12 @@
|
|
152
152
|
|
153
153
|
```
|
154
154
|
|
155
|
-
|
156
|
-
|
157
155
|
いちおうManifest.xmlです。
|
158
156
|
|
157
|
+
|
158
|
+
|
159
|
+
MainActivity.java
|
160
|
+
|
159
161
|
```xml
|
160
162
|
|
161
163
|
<?xml version="1.0" encoding="utf-8"?>
|
@@ -217,3 +219,167 @@
|
|
217
219
|
</manifest>
|
218
220
|
|
219
221
|
```
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
```java
|
226
|
+
|
227
|
+
import android.content.ContentValues;
|
228
|
+
|
229
|
+
import android.content.Intent;
|
230
|
+
|
231
|
+
import android.support.v7.app.AppCompatActivity;
|
232
|
+
|
233
|
+
import android.os.Bundle;
|
234
|
+
|
235
|
+
import android.database.Cursor;
|
236
|
+
|
237
|
+
import android.database.sqlite.SQLiteDatabase;
|
238
|
+
|
239
|
+
import android.view.View;
|
240
|
+
|
241
|
+
import android.widget.Button;
|
242
|
+
|
243
|
+
import android.widget.EditText;
|
244
|
+
|
245
|
+
import android.widget.TextView;
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
public class MainActivity extends AppCompatActivity {
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
private TextView textView;
|
254
|
+
|
255
|
+
private TestOpenHelper helper;
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
@Override
|
260
|
+
|
261
|
+
protected void onCreate(Bundle savedInstanceState) {
|
262
|
+
|
263
|
+
super.onCreate(savedInstanceState);
|
264
|
+
|
265
|
+
setContentView(R.layout.activity_main);
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
// DB作成
|
272
|
+
|
273
|
+
helper = new TestOpenHelper(getApplicationContext());
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
// // 変数textViewに表示するテキストビューのidを格納
|
278
|
+
|
279
|
+
// textView = findViewById(R.id.text_view);
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
// 商品登録
|
284
|
+
|
285
|
+
Button addItemBtn = findViewById(R.id.addItemBtn);
|
286
|
+
|
287
|
+
addItemBtn.setOnClickListener(new View.OnClickListener() {
|
288
|
+
|
289
|
+
@Override
|
290
|
+
|
291
|
+
public void onClick(View view) {
|
292
|
+
|
293
|
+
//インテントの作成
|
294
|
+
|
295
|
+
Intent intent = new Intent(getApplication(), AddItemActivity.class);
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
//遷移先の画面を起動
|
300
|
+
|
301
|
+
startActivity(intent);
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
});
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
// 商品確認
|
310
|
+
|
311
|
+
Button seeBtn = findViewById(R.id.seeBtn);
|
312
|
+
|
313
|
+
seeBtn.setOnClickListener(new View.OnClickListener() {
|
314
|
+
|
315
|
+
@Override
|
316
|
+
|
317
|
+
public void onClick(View view) {
|
318
|
+
|
319
|
+
Intent intent = new Intent(getApplication(), ItemsSeeActivity.class);
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
startActivity(intent);
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
});
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
// レジ買い物
|
332
|
+
|
333
|
+
Button RegiBtn = findViewById(R.id.RegiBtn);
|
334
|
+
|
335
|
+
RegiBtn.setOnClickListener(new View.OnClickListener() {
|
336
|
+
|
337
|
+
@Override
|
338
|
+
|
339
|
+
public void onClick(View view) {
|
340
|
+
|
341
|
+
Intent intent = new Intent(getApplication(), RegiActivity.class);
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
startActivity(intent);
|
346
|
+
|
347
|
+
}
|
348
|
+
|
349
|
+
});
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
// 電卓
|
354
|
+
|
355
|
+
Button calculatorBtn = findViewById(R.id.calculatorBtn);
|
356
|
+
|
357
|
+
calculatorBtn.setOnClickListener(new View.OnClickListener() {
|
358
|
+
|
359
|
+
@Override
|
360
|
+
|
361
|
+
public void onClick(View view) {
|
362
|
+
|
363
|
+
Intent intent = new Intent(getApplication(), CalculatorActivity.class);
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
startActivity(intent);
|
368
|
+
|
369
|
+
}
|
370
|
+
|
371
|
+
});
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
}
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
}
|
384
|
+
|
385
|
+
```
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -217,9 +217,3 @@
|
|
217
217
|
</manifest>
|
218
218
|
|
219
219
|
```
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
毎回同じ人物からアラ探しをあーだこーだ言われますが、その人は毎回解答しません
|
224
|
-
|
225
|
-
さてどなたでしょう
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
Androidスタジオで画面遷移をした際にSQLite
|
1
|
+
Androidスタジオで作成中のAndroidアプリ内で画面遷移をした際に同じAndroidアプリの遷移先ページで同じAndroidアプリで使用しているデータベースのSQLiteに保存されているレコードの一覧を表示するようにしたいです。
|
2
|
-
|
2
|
+
|
3
|
-
が、mainActivityからレコードを表示するアクティビティ(ItemsSeeActivity)にレイアウトの移動も出来なくなっています。
|
3
|
+
が、mainActivityから同じAndroidアプリに保存されているSQLiteのレコードの一覧を表示するためのアクティビティ(ItemsSeeActivity)にレイアウトの移動も出来なくなっています。
|
4
4
|
|
5
5
|
アプリが止まります。
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
ボタンがトリガーであればレコードの表示は出来
|
9
|
+
ボタンがトリガーであればデータベースのSQLiteからレコード一覧の表示は出来ますが、同じAndroidアプリで同じAndroidアプリの別レイアウトへ画面遷移(読み込み)をトリガーにしてレコード一覧を表示することができませんでした。
|
10
10
|
|
11
11
|
そこのレクチャーをお願いします。
|
12
12
|
|
@@ -217,3 +217,9 @@
|
|
217
217
|
</manifest>
|
218
218
|
|
219
219
|
```
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
毎回同じ人物からアラ探しをあーだこーだ言われますが、その人は毎回解答しません
|
224
|
+
|
225
|
+
さてどなたでしょう
|