{"id":127,"date":"2018-01-04T16:27:59","date_gmt":"2018-01-04T15:27:59","guid":{"rendered":"https:\/\/www.cipv6.de\/worp\/?p=127"},"modified":"2018-01-04T16:27:59","modified_gmt":"2018-01-04T15:27:59","slug":"android-log-or-toast-the-selected-item-in-an-listview","status":"publish","type":"post","link":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/","title":{"rendered":"Android: Log or Toast the selected Item in an ListView"},"content":{"rendered":"<p>in case you have the need to log.i the selected item of an listview this snippet could help:<\/p>\n<p>&nbsp;<\/p>\n<p>[java]<\/p>\n<p>listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {<br \/>\n    @Override<br \/>\n    public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {<br \/>\n        CheckedTextView checkedTextView = (CheckedTextView) view;<\/p>\n<p>        String itemClicked = (String) listView.getAdapter().getItem(i);<\/p>\n<p>        if (checkedTextView.isChecked()) {<br \/>\n            Log.i(&quot;Info :&quot;,  itemClicked + &quot; is checked&quot;);<br \/>\n            Toast.makeText(UsersActivity.this, itemClicked + &quot; is checked&quot;, Toast.LENGTH_SHORT).show();<br \/>\n        } else {<br \/>\n            Log.i(&quot;Info :&quot;,   itemClicked + &quot; is NOT Checked&quot;);<br \/>\n            Toast.makeText(UsersActivity.this, itemClicked + &quot; is NOT checked&quot;, Toast.LENGTH_SHORT).show();<br \/>\n        }<br \/>\n    }<br \/>\n[\/java]<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>in case you have the need to log.i the selected item of an listview this snippet could help: &nbsp; [java] listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) { CheckedTextView checkedTextView = (CheckedTextView) view; String itemClicked = (String) listView.getAdapter().getItem(i); if (checkedTextView.isChecked()) { Log.i(&quot;Info :&quot;, itemClicked + &quot; is checked&quot;); &hellip; <a href=\"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Android: Log or Toast the selected Item in an ListView&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[39,59],"class_list":["post-127","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-android","tag-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android: Log or Toast the selected Item in an ListView - cipv6.de<\/title>\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.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android: Log or Toast the selected Item in an ListView - cipv6.de\" \/>\n<meta property=\"og:description\" content=\"in case you have the need to log.i the selected item of an listview this snippet could help: &nbsp; [java] listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) { CheckedTextView checkedTextView = (CheckedTextView) view; String itemClicked = (String) listView.getAdapter().getItem(i); if (checkedTextView.isChecked()) { Log.i(&quot;Info :&quot;, itemClicked + &quot; is checked&quot;); &hellip; Continue reading &quot;Android: Log or Toast the selected Item in an ListView&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/\" \/>\n<meta property=\"og:site_name\" content=\"cipv6.de\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-04T15:27:59+00:00\" \/>\n<meta name=\"author\" content=\"ugu5ma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ugu5ma\" \/>\n<meta name=\"twitter:site\" content=\"@ugu5ma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ugu5ma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/01\\\/04\\\/android-log-or-toast-the-selected-item-in-an-listview\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/01\\\/04\\\/android-log-or-toast-the-selected-item-in-an-listview\\\/\"},\"author\":{\"name\":\"ugu5ma\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"headline\":\"Android: Log or Toast the selected Item in an ListView\",\"datePublished\":\"2018-01-04T15:27:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/01\\\/04\\\/android-log-or-toast-the-selected-item-in-an-listview\\\/\"},\"wordCount\":115,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"keywords\":[\"Android\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/01\\\/04\\\/android-log-or-toast-the-selected-item-in-an-listview\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/01\\\/04\\\/android-log-or-toast-the-selected-item-in-an-listview\\\/\",\"url\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/01\\\/04\\\/android-log-or-toast-the-selected-item-in-an-listview\\\/\",\"name\":\"Android: Log or Toast the selected Item in an ListView - cipv6.de\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#website\"},\"datePublished\":\"2018-01-04T15:27:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/01\\\/04\\\/android-log-or-toast-the-selected-item-in-an-listview\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/01\\\/04\\\/android-log-or-toast-the-selected-item-in-an-listview\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/01\\\/04\\\/android-log-or-toast-the-selected-item-in-an-listview\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android: Log or Toast the selected Item in an ListView\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#website\",\"url\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/\",\"name\":\"cipv6.de\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\",\"name\":\"ugu5ma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"caption\":\"ugu5ma\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/cipv6.de\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android: Log or Toast the selected Item in an ListView - cipv6.de","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.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/","og_locale":"en_US","og_type":"article","og_title":"Android: Log or Toast the selected Item in an ListView - cipv6.de","og_description":"in case you have the need to log.i the selected item of an listview this snippet could help: &nbsp; [java] listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) { CheckedTextView checkedTextView = (CheckedTextView) view; String itemClicked = (String) listView.getAdapter().getItem(i); if (checkedTextView.isChecked()) { Log.i(&quot;Info :&quot;, itemClicked + &quot; is checked&quot;); &hellip; Continue reading \"Android: Log or Toast the selected Item in an ListView\"","og_url":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/","og_site_name":"cipv6.de","article_published_time":"2018-01-04T15:27:59+00:00","author":"ugu5ma","twitter_card":"summary_large_image","twitter_creator":"@ugu5ma","twitter_site":"@ugu5ma","twitter_misc":{"Written by":"ugu5ma","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/#article","isPartOf":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/"},"author":{"name":"ugu5ma","@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"headline":"Android: Log or Toast the selected Item in an ListView","datePublished":"2018-01-04T15:27:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/"},"wordCount":115,"commentCount":0,"publisher":{"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"keywords":["Android"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/","url":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/","name":"Android: Log or Toast the selected Item in an ListView - cipv6.de","isPartOf":{"@id":"https:\/\/www.cipv6.de\/worp\/#website"},"datePublished":"2018-01-04T15:27:59+00:00","breadcrumb":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cipv6.de\/worp\/"},{"@type":"ListItem","position":2,"name":"Android: Log or Toast the selected Item in an ListView"}]},{"@type":"WebSite","@id":"https:\/\/www.cipv6.de\/worp\/#website","url":"https:\/\/www.cipv6.de\/worp\/","name":"cipv6.de","description":"","publisher":{"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cipv6.de\/worp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d","name":"ugu5ma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","caption":"ugu5ma"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g"},"sameAs":["https:\/\/cipv6.de"]}]}},"_links":{"self":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts\/127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/comments?post=127"}],"version-history":[{"count":0,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts\/127\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/media?parent=127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/categories?post=127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/tags?post=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}