What if I have 50 views? Should I have 50 static inner classes in my adapter? According to this answer , yes.
My first thought was to move each viewer's inner class to a separate public class, but they should be static. So, encapsulate each of them in an open class to make the inner class static? Are there any nicer alternatives?
edit: sample code: So would that be a good solution? Doesn't that kill performance?
public class MainViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener { View container; TextView title;
edit2: sample when a new instance of the view object is returned
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case 0: return new MainViewHolder(...); case 2: return new MainViewHolderOther(...); ... } }
android adapter android-recyclerview
Tamas
source share