{"id":1907,"date":"2018-04-11T15:49:14","date_gmt":"2018-04-11T06:49:14","guid":{"rendered":"http:\/\/kuuur.net\/?p=1907"},"modified":"2018-04-11T15:51:41","modified_gmt":"2018-04-11T06:51:41","slug":"android%e3%82%a2%e3%83%97%e3%83%aa%ef%bc%9aclass-anonymous-class-derived-from-onitemclicklistener-%e3%81%ae%e3%82%a8%e3%83%a9%e3%83%bc","status":"publish","type":"post","link":"https:\/\/kuuur.net\/?p=1907","title":{"rendered":"Android\u30a2\u30d7\u30ea\uff1aClass &#8216;Anonymous class derived from OnItemClickListener&#8217;&#8230;\u306e\u30a8\u30e9\u30fc"},"content":{"rendered":"<p>Android Studio\u3067\u958b\u767a\u4e2d\u306b\u3001ListView\u3092\u4f7f\u3063\u3066\u3044\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u305f\u5834\u5408\u306e\u7406\u7531\u3067\u3059\u3002<\/p>\n<div class=\"source\">\n<pre>Class 'Anonymous class derived from OnItemClickListener' must either be declared abstract or implement abstract method 'onItemClick(AdapterView&lt;?&gt;, View, int, long)' in 'OnItemClickListener'<\/pre>\n<\/div>\n<h2>\u539f\u56e0\u306fonItemClick\u30e1\u30bd\u30c3\u30c9\u306e\u5b9f\u88c5\u6f0f\u308c<\/h2>\n<p>\u4e0a\u8a18\u306e\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u3001\u7279\u5b9a\u306e\u30e1\u30bd\u30c3\u30c9\uff08onItemClick\uff09\u3092\u5b9f\u88c5\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3001\u3068\u3044\u3046\u8b66\u544a\u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u30b3\u30fc\u30c9\u4e2d\u306b\u3001onItemClick\u30e1\u30bd\u30c3\u30c9\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308b\u306e\u3067\u3001\u305f\u3068\u3048\u3070<\/p>\n<div class=\"source\">\n<pre>public void onItemClick(AdapterView parent, View view, int position, long id){ ... }<\/pre>\n<\/div>\n<p>\u3092\u30b3\u30fc\u30c9\u4e2d\u306b\u5165\u308c\u308c\u3070\u52d5\u4f5c\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"source\">\n<pre>ListView listView = findViewById(R.id.listview);\r\nArrayAdapter&lt;String&gt; arrayAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,listword[1]);\r\nlistView.setAdapter(arrayAdapter);\r\n\r\nlistView.setOnItemClickListener(new AdapterView.OnItemClickListener(){\r\n    public void onItemClick(AdapterView parent, View view, int position, long id){\r\n\r\n}\r\n}<\/pre>\n<\/div>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001<br \/>\nlistView.setOnItemClickListener(new AdapterView.OnItemClickListener(){}<br \/>\n\u3060\u3051\u66f8\u3044\u3066\u52d5\u4f5c\u78ba\u8a8d\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u3053\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<br \/>\n\u307e\u305f\u3001onItemClick()\u3092\u3001OnItemClick()\u306e\u3088\u3046\u306b\u4e00\u6587\u5b57\u304c\u5927\u6587\u5b57\u306b\u306a\u3063\u3066\u3044\u308b\u3060\u3051\u3067\u3082\u540c\u69d8\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u308b\u306e\u3067\u3001\u30b1\u30a2\u30ec\u30b9\u30df\u30b9\u306e\u30c1\u30a7\u30c3\u30af\u3082\u5fc5\u8981\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android Studio\u3067\u958b\u767a\u4e2d\u306b\u3001ListView\u3092\u4f7f\u3063\u3066\u3044\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u305f\u5834\u5408\u306e\u7406\u7531\u3067\u3059\u3002 Class &#8216;Anonymous class derived from OnIt&#8230;<span class=\"continue\"><a href=\"https:\/\/kuuur.net\/?p=1907\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-1907","post","type-post","status-publish","format-standard","hentry","category-android"],"views":4947,"_links":{"self":[{"href":"https:\/\/kuuur.net\/index.php?rest_route=\/wp\/v2\/posts\/1907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kuuur.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kuuur.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kuuur.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kuuur.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1907"}],"version-history":[{"count":2,"href":"https:\/\/kuuur.net\/index.php?rest_route=\/wp\/v2\/posts\/1907\/revisions"}],"predecessor-version":[{"id":1909,"href":"https:\/\/kuuur.net\/index.php?rest_route=\/wp\/v2\/posts\/1907\/revisions\/1909"}],"wp:attachment":[{"href":"https:\/\/kuuur.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kuuur.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kuuur.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}