Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mykotlin.pdf

0d5485b71547e0c49dfc453d2f582e1d?s=47 horinoA
January 08, 2016

 Mykotlin.pdf

0d5485b71547e0c49dfc453d2f582e1d?s=128

horinoA

January 08, 2016
Tweet

Other Decks in Technology

Transcript

  1. "OESPJEͰͪΐ͍,PUMJO @horinoA QIPUPCZ'SBOL7BTTFO$$#:

  2. ࣗ෼୭ͳΜʁ w !IPSJOP" w +BWBঁࢠؔ੢Ͱָ͘͠ษڧͯ͠ΔΞϚνϡΞϓ ϩάϥϚ w 4XJGU΍Β,PUMJO΍Β࠷ۙௗ͍ͮͯΔ w ޷͖ͳञ͸8*-%5"3,:ʢ໺ੜͷࣣ໘ௗʣͱ

    '".064(3064&ʢ͔ͷ༗໊ͳཕௗʣ
  3. "OESPJE͸+BWBͰ͢ΑͶPS[ *%&ิ׬͋Δͱ͸͍͑ίʔϧόοΫͱ͔௕͍Θʂ

  4. ,PUMJO͕͍͍Β͍͠ʁ w +7.্Ͱಈ͘ w ؔ਺Ϧςϥϧ΍ܕਪ࿦࢖͑Δ͍ΘΏΔϞμϯͳݴޠ w 4XJGUͱࣅͯΔʁʢॻ͍ͨ͜ͱ͋Δʣ w "OESPJE΋ϥΠϒϥϦ0QFO+%,ͳΔΒ͍͚͠Ͳ+BWBͱ ͔·ͩ౰෼ઌͷ࿩ɾɾɾ

    w 4XJGU"OESPJEͱ͔4DBMB"OESPJEͱ͔ɺͿͬͪΌ͚ҵͷಓ ͳΜ͡Όɾɾɾ
  5. ࢼͯ͠ΈΑ͏͔ ϛʔϋʔͳͷΑwww

  6. Πϯετʔϧͯ͠ΈΔ w ,PUMJOGPS"OESPJE͜ͱ͸͡Ί
 IUUQXXXHBQSPUKQQJDLVQUJQTLPUMJO@GPS@BOESPJE  w +BWBΠϕϯτKKVH@DDDͰ,PUMJOͷൃද͖ͯͨ͠Α
 IUUQUBSPIBUFOBCMPHKQFOUSZ  w

    Λࢀߟʹ$POpHVSFˠ1MVHJOTͰ,PUMJOݕࡧ w ී௨ʹΠϯετʔϧ w ͜Ε͚ͩ
  7. ,PUMJOΫϥεΛ࡞Δ w ࠷ॳ͸؆୯ͳσʔλΫϥεɺ.ZEBUBLU࡞੒ w ,PUMJOίʔυ༻ͷϑΥϧμ࡞੒͸͓޷ΈͰ CVJMEHSBEMFʹ TPVSDF4FUTͷઃఆཁ  w 5PPMT,PUMJO$POpHVSF,PUMJO1SPKFDUͰCVJMEHSBEMF

    ΁,PUMJO༻ͷهड़ΛڐՄ͢Δઃఆʹ͢Δ w +BWBΫϥεΛ,PUMJOʹม׵͔ɺ+BWBΫϥε͔Β,PUMJOΫϥε ͷΠϯελϯε֫ಘͨ͠λΠϛϯάͰCVJMEHSBEMF͕,PUMJO ༻ઃఆʹมߋ͞ΕΔͬΆ͍
  8. +BWBଆ͔ΒݺΜͰΈΔ ී௨ʹϝιουग़Δ͠ɺಛʹͳΜͷ໰୊΋ͳ͔ͭ͑͘·͢ ʢͰ΋+BWBͷTFUUFS HFUUFSͱνϣτҧ͏ͷͰԼه֬ೝ͠ ͨ΄͏͕͍͍Ͱ͢ʣIUUQUBSPIBUFOBCMPHKQFOUSZ 

  9. ΋͏ͪΐͬͱൃల
 ͤ͞Α͏͔ʁ ͪΐͬͱ࣮ફతͳ࿅श $BMMCBDLTJOQMBDFPGHFOFSBUPSTJO,PUMJO IUUQKBNJFNDDSJOEMFPSHDBMMCBDLTQPPSNBOTZJFMEIUNM Λࢀߟʹ

  10. ίʔϧόοΫ͔͍ͯΈΑ //Ҿ͖਺ʹؔ਺ϦςϥϧͭΊΔ fun testcall(settxt:String,callback:(String) -> Unit){
 val txt = "Hello

    "
 callback(txt + settxt)
 }
 
 fun runtest(){
 testcall("World",{println(it)})
 }
 //݁Ռ
 //System.out: Hello World

  11. ͑͑ײ͡ʹͳ͖ͬͯͨ

  12. 3FUSP'JUಋೖͯ͠ΈΑ͏ w 3&45௨৴؆୯ʹͯ͘͠ΕΔϥΠϒϥϦ w 3FUSP'JUͰ"OESPJEͷ3&45௨৴+40/ม׵Λ޾ͤʹ͢Δ
 IUUQRJJUBDPN)BNB5FDIJUFNTFBDEFDDECBG w 4JNQMF)551XJUI3FUSPpU
 IUUQTSFBMNJPOFXTESPJEDPOKBLFXIBSUPOTJNQMFIUUQ SFUSPpU

    w ͱެࣜαΠτ͋ͨΓΛࢀߟʹಋೖͯ͠ΈΔ
 IUUQTRVBSFHJUIVCJPSFUSPpUɹ

  13. +BWB'JMFˠ,PUMJO'JMFΛ׆༻ fun retroFitCall(city: Int?,callback:(WeatherEntity) -> Unit) {
 
 val retrofit

    = Retrofit.Builder()
 .baseUrl("http://weather.livedoor.com")
 .addConverterFactory(GsonConverterFactory.create())
 .build()
 val service = retrofit.create(WeatherApi::class.java)
 
 val call = service.getWeather(city)
 call.enqueue(object : Callback<WeatherEntity> {
 override fun onResponse(response: Response<WeatherEntity>, retrofit: Retrofit) {
 callback(response.body())
 }
 override fun onFailure(t: Throwable) {
 callback(null!!)
 }
 })
 ,PUMJOΫϥεͰϥΠϒϥϦॻ͘ͱίʔυิ׬ͯ͘͠Εͳͯ͘ɺ͔ ͳΓਏຯ͕͋ͬͨͷͰɺ·ͣ+BWBͰॻ͍͔ͯΒ$PEFˠ$POWFSU +BWB'JMFUP,PUMJO'JMFͰ,PUMJOΫϥεʹมߋͨ͠΄͏ָ͕Ͱ͢
  14. Ͱɺݺͼग़͢ଆ΋,PUMJOͰॻ͘ fun reflashListFragment() {
 val retro = RetroFitTest()
 retro.retroFitCall(400040,{
 if

    (it != null){
 Log.d("retro", "retrofitOk")
 mAdapter?.clear()
 mAdapter?.addAll(it.forecasts)
 mAdapter?.notifyDataSetChanged()
 }else{
 Log.d("retro", "retrofitError")
 }
 })
 }
  15. Ͱ͖ͨ 8FC"QJ -JWFEPPSఱؾ ୟ͚ͨ

  16. ඇಉظॲཧ΍ίʔϧόοΫͷ Α͏ͳɺؔ਺Ϧςϥϧ͕ಘҙ ͦ͏ͳ෦෼ͷΈ,PUMJOͰॻ͍ ͯޙ͸+BWBͰ͢·͢ͱಋೖ͠ ΍͍͔͢ͳʁͬͯײ͡Ͱ͢ɻ

  17. ͝੩ௌ͋Γ͕ͱ͏ ͍͟͝·ͨ͠

  18. ි౤͛Δ࣌͸ ༏ͯ͘͠͠Ͷ ʍТɾˑ ͯ΁΃Ζ

  19. ࣗ࡞"OESPJEΞϓϦެ։த w (PPHMF1MBZͰ ʮ͖ΐ͏͍͘ͱ͜ʯ ͓खܰ஍ਤΞϓϦ Ͱ͢ɻ%-ͯ͠Ͷ

  20. ࢀরαΠτ w (JU)VCʹϓϩδΣΫτ͋͛ͯ·͢
 IUUQTHJUIVCDPNIPSJOP" w ެࣜϦϑΝϨϯε
 IUUQTLPUMJOMBOHPSHEPDTSFGFSFODF w ࢉේԦʹ͓Ε͸ͳΔ
 ೔ຊ,PUMJOϢʔβʔάϧʔϓձ௕ͨΖ͏͞ΜͷαΠτɻ,PUMJOϢʔβʔඞಡ


    IUUQUBSPIBUFOBCMPHKQ w ٯҾ͖LPUMJO
 !ZZ@ZBOL͞Μ͕࡞੒͞ΕͨٯҾ͖αΠτɻ
 IUUQLPUMJOSFWTPMVUJPOIFSPLVBQQDPNTJUF@ w ,PUMJOͷίʔσΟϯά͕௙Δඪ४ϥΠϒϥϦ
 IUUQRJJUBDPNESPJCJUJUFNTDCCCUISFBELU w ,PUMJOͰϦεφʔ΍ίʔϧόοΫΛεοΩϦͱॻ͘ʲؔ਺Ϧςϥϧͱ4".ม׵ʳ
 IUUQRJJUBDPN3ZPUB.VSPIPTIJJUFNTCGBCGGD w ,PUMJO"EWFOU$BMFOEBS
 IUUQXXXBEWFOUBSPSHDBMFOEBST