{"id":17411,"date":"2013-09-20T13:00:24","date_gmt":"2013-09-20T10:00:24","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=17411"},"modified":"2023-12-05T13:50:38","modified_gmt":"2023-12-05T11:50:38","slug":"android-viewholder-pattern-example","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html","title":{"rendered":"Android ViewHolder Pattern Example"},"content":{"rendered":"<p>Now we are going to code the smooth scrolling of our Android ListView. In the <a href=\"http:\/\/www.codeofaninja.com\/2013\/09\/android-listview-with-adapter-example.html\" target=\"_blank\" rel=\"noopener\">previous post<\/a>, we tried to understand how the ListView with adapter works. This time, it will be all about performance.<\/p>\n<p>I did this a separate post because <a href=\"http:\/\/android-developers.blogspot.com\/2009\/01\/why-is-my-list-black-android.html\" target=\"_blank\" rel=\"noopener\">Android ListView is difficult to understand<\/a> at times. What I have in mind is, &#8220;we have to do the basics first, and then apply the optimization.&#8221;<\/p>\n<h2>What&#8217;s with the ViewHolder pattern?<\/h2>\n<p>The ViewHolder design pattern enables you to access each list item view without the need for the look up, saving valuable processor cycles. Specifically, it avoids frequent call of findViewById() during ListView scrolling, and that will make it smooth.<\/p>\n<h2>Without the ViewHolder Design Pattern<\/h2>\n<p>Okay, let&#8217;s dig it out and see how it works <i>without <\/i>the ViewHolder pattern.<\/p>\n<p>Let&#8217;s take a look at our <i>previous <\/i>getView() method in ArrayAdapterItem.java<\/p>\n<ol>\n<li>The first time it was loaded, convertView is null. We&#8217;ll have to inflate our list item layout and find the TextView via\u00a0findViewById().<\/li>\n<li>The second time it was loaded, convertView is not null, good! We don&#8217;t have to inflate it again. But we&#8217;ll use\u00a0findViewById() again.<\/li>\n<li>The following times it was loaded, convertView is definitely not null. But\u00a0findViewById() is constantly called, it will work but, it slows down the performance especially if you have lots of items and Views in your ListView.<\/li>\n<\/ol>\n<h2>With the ViewHolder Design Pattern<\/h2>\n<p>Now let&#8217;s see how it works <i>with <\/i>the ViewHolder pattern.<\/p>\n<ol>\n<li>The first time it was loaded, convertView is null. We&#8217;ll have to inflate our list item layout, instantiate the ViewHolder, find the TextView via\u00a0findViewById() and assign it to the ViewHolder, and set the ViewHolder as tag of convertView.<\/li>\n<li>The second time it was loaded, convertView is not null, good! We don&#8217;t have to inflate it again. And here&#8217;s the sweet thing, we won&#8217;t have to call findViewById() since we can now access the TextView via its ViewHolder.<\/li>\n<li>The following time it was loaded, convertView is definitely not null. The findViewById() is never called again, and that makes our smooth ListView scrolling.<\/li>\n<\/ol>\n<h2>Let&#8217;s Code!<\/h2>\n<p>So here it is, we&#8217;ll make use of the <a href=\"http:\/\/developer.android.com\/training\/improving-layouts\/smooth-scrolling.html#ViewHolder\" target=\"_blank\" rel=\"noopener\"> Android ViewHolder pattern<\/a> in our ListView (in just 3 steps!).<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><b>Step 1<\/b>: Add the following static class on our ArrayAdapterItem.java file<\/p>\n<pre class=\" brush:java\">\/\/ our ViewHolder.\n\/\/ caches our TextView\nstatic class ViewHolderItem {\n    TextView textViewItem;\n}<\/pre>\n<p><b>Step 2<\/b>: Our getView() will now look like this:<\/p>\n<pre class=\" brush:java\">@Override\npublic View getView(int position, View convertView, ViewGroup parent) {\n\n    ViewHolderItem viewHolder;\n\n    \/*\n     * The convertView argument is essentially a \"ScrapView\" as described is Lucas post \n     * http:\/\/lucasr.org\/2012\/04\/05\/performance-tips-for-androids-listview\/\n     * It will have a non-null value when ListView is asking you recycle the row layout. \n     * So, when convertView is not null, you should simply update its contents instead of inflating a new row layout.\n     *\/\n    if(convertView==null){\n\n        \/\/ inflate the layout\n        LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();\n        convertView = inflater.inflate(layoutResourceId, parent, false);\n\n        \/\/ well set up the ViewHolder\n        viewHolder = new ViewHolderItem();\n        viewHolder.textViewItem = (TextView) convertView.findViewById(R.id.textViewItem);\n\n        \/\/ store the holder with the view.\n        convertView.setTag(viewHolder);\n\n    }else{\n        \/\/ we've just avoided calling findViewById() on resource everytime\n        \/\/ just use the viewHolder\n        viewHolder = (ViewHolderItem) convertView.getTag();\n    }\n\n    \/\/ object item based on the position\n    ObjectItem objectItem = data[position];\n\n    \/\/ assign values if the object is not null\n    if(objectItem != null) {\n        \/\/ get the TextView from the ViewHolder and then set the text (item name) and tag (item ID) values\n        viewHolder.textViewItem.setText(objectItem.itemName);\n        viewHolder.textViewItem.setTag(objectItem.itemId);\n    }\n\n    return convertView;\n\n}<\/pre>\n<p>[ulp id=&#8217;luHisu6VPL9Mt6IB&#8217;]<br \/>\n<b>Step 3<\/b>: For the sake of testing, we&#8217;re going to put thousands of items in our ListView. On our MainActivity.java, our\u00a0showPopUp() will now look like this:<\/p>\n<pre class=\" brush:java\">public void showPopUp(){\n\n    \/\/ we'll specify the number of items we want our ListView to have.\n    int numberOfItems = 1000;\n\n    \/\/ add your items, this can be done programatically\n    \/\/ your items can be from a database\n    ObjectItem[] ObjectItemData = new ObjectItem[numberOfItems];\n\n    \/\/ we'll use a for loop \n    \/\/ created objects = number of items specified above\n    for(int x=0; x&lt;numberOfItems; x++){\n\n        int sampleId = 90 + x;\n        ObjectItemData[x] = new ObjectItem(sampleId, \"Store # \" + (x+1));\n\n    }\n\n    \/\/ our adapter instance\n    ArrayAdapterItem adapter = new ArrayAdapterItem(this, R.layout.list_view_row_item, ObjectItemData);\n\n    \/\/ create a new ListView, set the adapter and item click listener\n    ListView listViewItems = new ListView(this);\n    listViewItems.setAdapter(adapter);\n    listViewItems.setOnItemClickListener(new OnItemClickListenerListViewItem());\n\n    \/\/ put the ListView in the pop up\n    alertDialogStores = new AlertDialog.Builder(MainActivity.this)\n        .setView(listViewItems)\n        .setTitle(\"Stores\")\n        .show();\n\n}<\/pre>\n<p>I tested this code with as much as 2,000 items, and the performance is still smooth and great.<\/p>\n<h2>What&#8217;s Next?<\/h2>\n<p>If you have other ideas regarding this topic, please drop it in the comment section below. I&#8217;m more than willing to update this post and improve the life of mankind.<\/p>\n<p>In the next post, we&#8217;ll try to use the AsyncTask to load image into the ListView. Something like how the Google Play Store app does it.<br \/>\n&nbsp;<\/p>\n<div style=\"border: 1px solid #D8D8D8; background: #FAFAFA; width: 100%; padding-left: 5px;\"><b><i>Reference: <\/i><\/b><a href=\"http:\/\/www.codeofaninja.com\/2013\/09\/android-viewholder-pattern-example.html\">Android ViewHolder Pattern Example<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\">JCG partner<\/a> Mike Dalisay at the <a href=\"http:\/\/www.codeofaninja.com\/\">The Code of a Ninja<\/a> blog.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Now we are going to code the smooth scrolling of our Android ListView. In the previous post, we tried to understand how the ListView with adapter works. This time, it will be all about performance. I did this a separate post because Android ListView is difficult to understand at times. What I have in mind &hellip;<\/p>\n","protected":false},"author":458,"featured_media":46,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-17411","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android-core"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android ViewHolder Pattern Example<\/title>\n<meta name=\"description\" content=\"Now we are going to code the smooth scrolling of our Android ListView. In the previous post, we tried to understand how the ListView with adapter works.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android ViewHolder Pattern Example\" \/>\n<meta property=\"og:description\" content=\"Now we are going to code the smooth scrolling of our Android ListView. In the previous post, we tried to understand how the ListView with adapter works.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2013-09-20T10:00:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-05T11:50:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mike Dalisay\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mike Dalisay\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html\"},\"author\":{\"name\":\"Mike Dalisay\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/80afa5bba9e72c0ece4033703bb74bd9\"},\"headline\":\"Android ViewHolder Pattern Example\",\"datePublished\":\"2013-09-20T10:00:24+00:00\",\"dateModified\":\"2023-12-05T11:50:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html\"},\"wordCount\":531,\"commentCount\":17,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/android-logo.jpg\",\"articleSection\":[\"Android Core\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html\",\"name\":\"Android ViewHolder Pattern Example\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/android-logo.jpg\",\"datePublished\":\"2013-09-20T10:00:24+00:00\",\"dateModified\":\"2023-12-05T11:50:38+00:00\",\"description\":\"Now we are going to code the smooth scrolling of our Android ListView. In the previous post, we tried to understand how the ListView with adapter works.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/android-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/android-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/09\\\/android-viewholder-pattern-example.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/android\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Android Core\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/android\\\/android-core\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Android ViewHolder Pattern Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/80afa5bba9e72c0ece4033703bb74bd9\",\"name\":\"Mike Dalisay\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bcd6198e748dd8afcc6285fe7f23ebf1e50c82389162d94eea98443c9fffc597?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bcd6198e748dd8afcc6285fe7f23ebf1e50c82389162d94eea98443c9fffc597?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bcd6198e748dd8afcc6285fe7f23ebf1e50c82389162d94eea98443c9fffc597?s=96&d=mm&r=g\",\"caption\":\"Mike Dalisay\"},\"sameAs\":[\"http:\\\/\\\/www.codeofaninja.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/mike-dalisay\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android ViewHolder Pattern Example","description":"Now we are going to code the smooth scrolling of our Android ListView. In the previous post, we tried to understand how the ListView with adapter works.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html","og_locale":"en_US","og_type":"article","og_title":"Android ViewHolder Pattern Example","og_description":"Now we are going to code the smooth scrolling of our Android ListView. In the previous post, we tried to understand how the ListView with adapter works.","og_url":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-09-20T10:00:24+00:00","article_modified_time":"2023-12-05T11:50:38+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg","type":"image\/jpeg"}],"author":"Mike Dalisay","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Mike Dalisay","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html"},"author":{"name":"Mike Dalisay","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/80afa5bba9e72c0ece4033703bb74bd9"},"headline":"Android ViewHolder Pattern Example","datePublished":"2013-09-20T10:00:24+00:00","dateModified":"2023-12-05T11:50:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html"},"wordCount":531,"commentCount":17,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg","articleSection":["Android Core"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html","url":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html","name":"Android ViewHolder Pattern Example","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg","datePublished":"2013-09-20T10:00:24+00:00","dateModified":"2023-12-05T11:50:38+00:00","description":"Now we are going to code the smooth scrolling of our Android ListView. In the previous post, we tried to understand how the ListView with adapter works.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2013\/09\/android-viewholder-pattern-example.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/www.javacodegeeks.com\/category\/android"},{"@type":"ListItem","position":3,"name":"Android Core","item":"https:\/\/www.javacodegeeks.com\/category\/android\/android-core"},{"@type":"ListItem","position":4,"name":"Android ViewHolder Pattern Example"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/80afa5bba9e72c0ece4033703bb74bd9","name":"Mike Dalisay","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/bcd6198e748dd8afcc6285fe7f23ebf1e50c82389162d94eea98443c9fffc597?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/bcd6198e748dd8afcc6285fe7f23ebf1e50c82389162d94eea98443c9fffc597?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bcd6198e748dd8afcc6285fe7f23ebf1e50c82389162d94eea98443c9fffc597?s=96&d=mm&r=g","caption":"Mike Dalisay"},"sameAs":["http:\/\/www.codeofaninja.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/mike-dalisay"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/17411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/458"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=17411"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/17411\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/46"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=17411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=17411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=17411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}