{"id":2048,"date":"2014-06-26T06:29:33","date_gmt":"2014-06-26T06:29:33","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=2048"},"modified":"2020-09-21T16:33:57","modified_gmt":"2020-09-21T07:33:57","slug":"android-%eb%a7%a8%eb%82%a0-%ea%b9%8c%eb%a8%b9%eb%8a%94-runonuithread-%ec%82%ac%ec%9a%a9%ec%98%88","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=2048","title":{"rendered":"[Android] \ub9e8\ub0a0 \uae4c\uba39\ub294 runOnUiThread \uc0ac\uc6a9\uc608"},"content":{"rendered":"<p><P>\ud1b5\uc2e0\uc744 \ud1b5\ud574 \ub370\uc774\ud130\ub97c \uc2a4\ub808\ub4dc\ub97c \ud1b5\ud574 \ub531&#8230; \uac00\uc838\uc624\uace0 \ub09c \ud6c4 \ub3d9\uc77c\ud55c \uc2a4\ub808\ub4dc\uc5d0\uc11c \ubc14\ub85c Spinner \ub4f1\uacfc \uac19\uc740 UI\uc5d0 \ub370\uc774\ud130\ub97c \uc124\uc815\ud558\uc2dc\uba74 \uc6b0\uc5d0\uc5d1~~ \ud558\uace0 \uad6c\ud1a0\ub97c \ud558\uc2dc\ub294 \uc548\ub4dc\ub85c\uc774\ub4dc\ub2d8.<\/P><\/p>\n<p><P>UI \ub2e8\uc5d0 \ub370\uc774\ud130\ub97c \uc124\uc815\ud560 \uc218 \uc788\ub294 \uad8c\ud55c\uc740 \uc624\uc9c1 UI \uc2a4\ub808\ub4dc, \uc989 \uba54\uc778 \uc2a4\ub808\ub4dc\ub9cc\uc774 \ud558\uc2e4 \uc218 \uc788\ub294 \uc804\uc9c0\uc804\ub2a5\ud558\uc2e0 \uad8c\ud55c\uc774\ubbc0\ub85c \uac10\ud788 \uc790\uc2dd \uc2a4\ub808\ub4dc\uc5d0\uc11c\ub294 \uae30\ub3c4\ub97c \ud1b5\ud574 \uc18c\uc6d0\uc744 \ube4c\uc5b4\uc57c \ud569\ub2c8\ub2e4. \uc548\ub4dc\ub85c\uc774\ub4dc\ub2d8\uaed8\uc11c\ub294 \uc774\ub7ec\ud55c \uae30\ub3c4\ub97c runOnUiThread\ub77c\ub294 Context\uc758 \ub9e4\uc11c\ub4dc\ub97c \ud1b5\ud574 \uac00\ub2a5\ud558\uac8c \ud558\uc635\uc2dc\uace0..<\/P><\/p>\n<p><P>\uc544\ub798\uc640 \uac19\uc740 \uc608\uc81c\ub97c \ud1b5\ud574 \uae30\ub3c4 \ubc29\ubc95\uc744 \uba54\ubaa8\ud558\uace0\uc790 \ud569\ub2c8\ub2e4.<\/P><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">String strJSON = event.getResultJSON();\r\n\r\nif(strJSON != null) {\r\n    if(event.getRequestId().compareTo(\"\ud589\uc815\uad6c\") == 0) {\r\n        JSONArray array = (JSONArray)JSONValue.parse(strJSON);\r\n        Iterator iter = array.iterator();\r\n\t\t\t\t\r\n        final ArrayList list = new ArrayList();\r\n        \r\n        while(iter.hasNext()) {\r\n            JSONObject obj = (JSONObject)iter.next();\r\n            Set keySet = obj.keySet();\r\n            Iterator keyIter = keySet.iterator();\r\n            while(keyIter.hasNext()) {\r\n            Object key = keyIter.next();\r\n            Object val = obj.get(key);\r\n            list.add(val);\r\n        }\r\n    }\t\r\n\t\t\t\t\r\n    Collections.sort(list);\r\n\t\t\t\t\r\n    this.runOnUiThread(\r\n        new Runnable() {\r\n            @Override\r\n            public void run() {\r\n                Spinner spGuName = (Spinner)findViewById(R.id.spGuName);\r\n                ArrayAdapter&lt;Object> adapter = new ArrayAdapter&lt;Object>(\r\n                    ActivitySearchLocation.this, \r\n                    R.layout.custom_simple_dropdown_item_1line, list.toArray()\r\n                );\r\n                spGuName.setAdapter(adapter);\t\t\t\t\t\t\r\n            }\r\n        });\r\n    }\r\n}<\/pre>\n<p>\uc704\uc758 \ucf54\ub4dc\ub294 \ub370\uc774\ud130\ub97c \uac00\uc838\uc624\ub294 \ud1b5\uc2e0 \uc2a4\ub808\ub4dc\uc5d0\uc11c \uc2e4\ud589\ub418\ub294 \ucf54\ub4dc\uc774\uace0 23\ubc88\uc9f8 \uc904\uc774 \ubc14\ub85c &#8216;\uae30\ub3c4&#8217;\uc5d0 \ud574\ub2f9\ud569\ub2c8\ub2e4. \uc815\uc791 \uc911\uc694\ud55c \ub0b4\uc6a9\ubcf4\ub2e4 \ubd80\uc218\uc801\uc778 \ub0b4\uc6a9\uc774 \ub354 \ub9ce\uc740 \ucf54\ub4dc\uc774\uc9c0\ub9cc.. \ub098\uc911\uc744 \uc704\ud574 Keep \ud574 \ub461\ub2c8\ub2e4. \ucc38\uace0\ub85c \uac00\uc838\uc628 \ub370\uc774\ud130\ub97c \ubc30\uc5f4\ub85c \uc800\uc7a5\ud558\uace0 \uc774\ub97c Collections \ud074\ub798\uc2a4\uc758 \uc815\uc801 \ud568\uc218\uc778 sort\ub97c \ud1b5\ud574 \uc815\ub82c\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud1b5\uc2e0\uc744 \ud1b5\ud574 \ub370\uc774\ud130\ub97c \uc2a4\ub808\ub4dc\ub97c \ud1b5\ud574 \ub531&#8230; \uac00\uc838\uc624\uace0 \ub09c \ud6c4 \ub3d9\uc77c\ud55c \uc2a4\ub808\ub4dc\uc5d0\uc11c \ubc14\ub85c Spinner \ub4f1\uacfc \uac19\uc740 UI\uc5d0 \ub370\uc774\ud130\ub97c \uc124\uc815\ud558\uc2dc\uba74 \uc6b0\uc5d0\uc5d1~~ \ud558\uace0 \uad6c\ud1a0\ub97c \ud558\uc2dc\ub294 \uc548\ub4dc\ub85c\uc774\ub4dc\ub2d8. UI \ub2e8\uc5d0 \ub370\uc774\ud130\ub97c \uc124\uc815\ud560 \uc218 \uc788\ub294 \uad8c\ud55c\uc740 \uc624\uc9c1 UI \uc2a4\ub808\ub4dc, \uc989 \uba54\uc778 \uc2a4\ub808\ub4dc\ub9cc\uc774 \ud558\uc2e4 \uc218 \uc788\ub294 \uc804\uc9c0\uc804\ub2a5\ud558\uc2e0 \uad8c\ud55c\uc774\ubbc0\ub85c \uac10\ud788 \uc790\uc2dd \uc2a4\ub808\ub4dc\uc5d0\uc11c\ub294 \uae30\ub3c4\ub97c \ud1b5\ud574 \uc18c\uc6d0\uc744 \ube4c\uc5b4\uc57c \ud569\ub2c8\ub2e4. \uc548\ub4dc\ub85c\uc774\ub4dc\ub2d8\uaed8\uc11c\ub294 \uc774\ub7ec\ud55c \uae30\ub3c4\ub97c runOnUiThread\ub77c\ub294 Context\uc758 \ub9e4\uc11c\ub4dc\ub97c &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=2048\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;[Android] \ub9e8\ub0a0 \uae4c\uba39\ub294 runOnUiThread \uc0ac\uc6a9\uc608&#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":[61],"tags":[],"class_list":["post-2048","post","type-post","status-publish","format-standard","hentry","category-android"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2048"}],"version-history":[{"count":5,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2048\/revisions"}],"predecessor-version":[{"id":10287,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2048\/revisions\/10287"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2048"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}