ViewHolder 클래스 만들기 1234567891011121314public class MyVh extends RecyclerView.ViewHolder{ private final ItemBinding binding; public MyVh(ItemBinding binding){ super(binding.getRoot()); this.binding = binding; } public void bind(Item item){ binding.setItem(item); binding.executePendingBindings(); }}Colored by Color Scriptercs 변수나 Observable이 변경되면 바인딩이 다음 프레임 전에 변경되도록 예약을 한다. 하지만 바인딩을 즉시 실행해야 할 때가 ..
Handler.handleMessage() 사용 123456789101112131415161718192021222324252627282930313233343536private final MyHandler handler = new MyHandler(this); private static class MyHandler extends Handler { private final WeakReference weakReference; public MyHandler(MainActivity activity) { this.weakReference = new WeakReference(activity); } @Override public void handleMessage(Message msg) { switch (msg.what..
Reachability GC는 reference의 강약에 따라 도달 가능한 객체를 제외하고모두 쓰레기로 간주한다 GC의 관점에서는 객체를 참조가 가능한 객체와 참조할 수 없는 객체로 본다즉, 내가 다시 사용할 수 있냐, 없냐를 보고없으면 쓰레기통으로 넣어버리는 것이다 Reference Object는 참조의 강약에 따라 Strong Reference, SoftReference, WeakReference, Phantom Reference로 나누고순서대로 참조가 강하다 * 하나의 객체가 Strong과 Weak 참조가 있다면 그 객체는Strong한 객체로 생각한다 Strong Reference Strong Reference는 new를 이용해 생성된 객체를 말한다이 객체는 GC에서 무조건 제외되기 때문에 Memo..