It is said that oncreateViewHolder returns viewholder object, What is
viewholder object does it contain all the views in single row? if
there is list of 1000 item how many viewobjects will be created?
One ViewHolder object for one view row. One ViewHolder object is created for every time the onCreateViewHolder is called. It is called based on the number of visible items in the device. Even if you have 100 items, if ony 10 items are visible, the onCreateViewHolder will be called 10 times and there will be 10 ViewHolders. (There might be one or two extra item based on the RecyclerView optimizations because if you scroll the list, the next item should be visible instantaneously)
My understanding: If we are creating viewholder object it contains
reference of view like findviewbyid, since findviewbyid is expansive
operation, so by viewholder we can create single viewholder object and
reuse by just setting image or text(happens in onBindView).
RecyclerView is already recycling and reusing the Views and the corresponding ViewHolders. The number of ViewHolder (and View) present at any time depends on the number visible items on the screen.
But onCreateViewHolder runs multiple times and as a result
findviewbyid will also execute multiple time, isn't performance issue?
As said previously, the number of times this will be called is only for the number of visible items. When you scroll, the views and viewholders are reused. You have distinct Views for each row. So there will be distinct ViewHolder for each row.
Also how its different from convertView of base adapter of simple
listview
In ListView, the convertView is the old view, which provides an option to reuse the same view for new rows as you scroll the list. But it's optional because the developer might not use the convertView at all. In RecyclerView the reusing of old views is done automatically.