質問編集履歴
2
該当ソースコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,6 +32,46 @@
|
|
32
32
|
```
|
33
33
|
|
34
34
|
### 該当のソースコード
|
35
|
+
```MainActivity.java
|
36
|
+
|
37
|
+
package jp.halo_sf.haloint;
|
38
|
+
|
39
|
+
import android.database.Cursor;
|
40
|
+
import android.os.Bundle;
|
41
|
+
|
42
|
+
import androidx.appcompat.app.AppCompatActivity;
|
43
|
+
import androidx.recyclerview.widget.LinearLayoutManager;
|
44
|
+
import androidx.recyclerview.widget.RecyclerView;
|
45
|
+
|
46
|
+
public class MainActivity extends AppCompatActivity {
|
47
|
+
private DatabaseHelper _helper;
|
48
|
+
private static RecyclerView rvNote;
|
49
|
+
private static RecyclerViewAdapter adapter;
|
50
|
+
|
51
|
+
@Override
|
52
|
+
protected void onCreate(Bundle savedInstanceState) {
|
53
|
+
super.onCreate(savedInstanceState);
|
54
|
+
setContentView(R.layout.activity_main);
|
55
|
+
|
56
|
+
//DatabaseHelperの生成処理。
|
57
|
+
_helper = new DatabaseHelper(MainActivity.this);
|
58
|
+
|
59
|
+
//RecyclerViewの設定。
|
60
|
+
rvNote = findViewById(R.id.rvNote);
|
61
|
+
rvNote.setLayoutManager(new LinearLayoutManager(MainActivity.this));
|
62
|
+
//DataBaseからデータを取得。
|
63
|
+
Cursor cursor = _helper.getData();
|
64
|
+
NoteManager noteManager = new NoteManager();
|
65
|
+
while (cursor.moveToNext()) {
|
66
|
+
noteManager.addNoteItem(String.valueOf(cursor.getInt(0)), cursor.getString(1), cursor.getString(2));
|
67
|
+
}
|
68
|
+
noteManager.addToMapData();
|
69
|
+
cursor.close();
|
70
|
+
adapter = new RecyclerViewAdapter(noteManager.getNoteItems());
|
71
|
+
rvNote.setAdapter(adapter);
|
72
|
+
}
|
73
|
+
|
74
|
+
```
|
35
75
|
|
36
76
|
```RecyclerViewAdapter.java
|
37
77
|
package jp.halo_sf.haloint;
|
1
タイトルの簡略化
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Android Studio:Dialog
|
1
|
+
Android Studio:Dialogの表示について
|
test
CHANGED
File without changes
|