"DUJWJUZੜ࣌ʹҾ͘
public class MainActivity extends AppCompatActivity {
…
public void onCreate(Bundle savedInstanceState) {
mRealmResults = mRealm.where().findAllAsync()
…
}
w ͙͢͞·3FBMN3FTVMUTΛಘΔ
w ਖ਼͘͠෮ݩ͢ΔͨΊʹ͏
Slide 41
Slide 41 text
"EBQUFSʹ3FBMN3FTVMU
public class EntriesAdapter {
public EntriesAdapter(RealmResults entries) {
mEntries = entries;
mRealmChangeListener = new RealmChangeListener() {
@Override
public void onChange() {
mListItems = getItems();
EpisodesAdapter.this.notifyDataSetChanged();
}
};
…
}
…
Slide 42
Slide 42 text
"EBQUFSʹ3FBMN3FTVMU
public class EntriesAdapter {
…
@Override
public void onAttachedToRecyclerView(RecyclerView
recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
mResults.addChangeListener(mRealmChangeListener);
}
@Override
public void onDetachedFromRecyclerView(RecyclerView
recyclerView) {
mResults.removeChangeListener(mRealmChangeListener);
super.onDetachedFromRecyclerView(recyclerView);
}
…
Slide 43
Slide 43 text
"DUJWJUZؒͷσʔλड͚͠
Intent intent = new Intent(context,
EpisodeActivity.class);
intent.putExtra(EXTRA_ID, Id);
w 3FBMNͷ*%Λ͢͜ͱʹͯ͠͠·͏
w ࠶ੜʹඋ͑ΕΔ͜ͱʹͳΔ
Slide 44
Slide 44 text
3FBMN
Λ
%BHHFS
Ͱ
εϨου͝ͱʹ*OKFDU
Slide 45
Slide 45 text
εϨου·ͨ͛ͳ͍
w 3FBMN*OTUBODF͕࡞͞ΕͨεϨου͔Βଞͷ
εϨουͰ͑ͳ͍
w ͔͠͠*OKFDUPO$SFBUF
Ͱߦ͍͍ͨ
w ʮผεϨου͕ཉ͍࣌͠ʹ*OKFDU͢ΔΈʯ͕
ඞཁ