<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[SH’s Blog - Medium]]></title>
        <description><![CDATA[Explore. Dream. Discover. - Medium]]></description>
        <link>https://medium.com/swan-htet-aung?source=rss----24905bc5e288---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>SH’s Blog - Medium</title>
            <link>https://medium.com/swan-htet-aung?source=rss----24905bc5e288---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 12:26:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/swan-htet-aung" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[၂၀၁၆]]></title>
            <link>https://medium.com/swan-htet-aung/%E1%81%82%E1%81%80%E1%81%81%E1%81%86-4af2ddaf2c?source=rss----24905bc5e288---4</link>
            <guid isPermaLink="false">https://medium.com/p/4af2ddaf2c</guid>
            <category><![CDATA[reflections]]></category>
            <dc:creator><![CDATA[Swan Htet Aung]]></dc:creator>
            <pubDate>Wed, 04 Jan 2017 15:49:15 GMT</pubDate>
            <atom:updated>2016-12-20T22:46:25.427Z</atom:updated>
            <content:encoded><![CDATA[<h4>ပြန်ကြည့်ခြင်း</h4><h4>မထင်မှတ်ဘဲအလုပ်ပြန်ဝင်ဖြစ်တယ်</h4><p>Bindez မှာ ဘာလို့ဝင်လုပ်ခဲ့တာလဲဆိုပြီး သိတဲ့သူ အတော်များများမေးကြတယ်။ အဲဒီတုန်းကအလုပ်လုပ်ဖို့ လာခေါ်တဲ့လူတိုင်းကို ကိုယ်တိုင်လုပ်နေတဲ့ app တစ်ခုရှိတယ်ဆိုတဲ့အကြောင်းပြချက်နဲ့ ငြင်းလွှတ်ခဲ့တာကို။ နောက်တော့ ကိုယ်နဲ့ အတူလုပ်မယ့်သူတွေကလဲ အချိန်ပြည့်မလုပ်နိုင်သေးတာနဲ့ ခဏလောက်အလုပ်ပြန်ဝင်ဖို့ ဖြစ်သွားရော။ အဲဒါနဲ့ပဲ ကိုယ်ကြိုက်တဲ့ Thadin app ကို အပြင်လူအနေနဲ့ အကြံပေးတာမထိရောက်မှာစိုးလို့၊ ကုမ္ပဏီထဲဝင်ပြီး ကိုယ်သုံးချင်တဲ့အတိုင်း ဝင်ပြင်ခဲ့တာပါ။ 😁 logo တွေ interface တွေကအစ ကိုယ့်ဟာကို အစအဆုံးပြန်လုပ်ပေးပြီး၊ application တစ်ခုမှာ အရေးအကြီးဆုံးလို့ ကျွန်တော်ယုံကြည်တဲ့ retention ကိုတက်လာအောင်လုပ်တာပါပဲ။ Bindez မှာ ကျွန်တော်လုပ်ခဲ့တာ ၅ လလောက်ပဲကြာပေမယ့်၊ အချိန်တိုလေးအတွင်းမှာ လုပ်ပေးနိုင်ခဲ့တဲ့ ရလာဒ်ကိုတော့ အရမ်းကျေနပ်မိတယ်။ သူတို့ app ရဲ့ retention rate ကို ၁၀ ဆမကဆွဲတင်ပေးနိုင်ခဲ့တာကိုအတော်လေး ဂုဏ်ယူတယ်။ ဘယ်လိုမှမဖြစ်နိုင်တဲ့ အချိန်အကန့်အသတ်ကြားထဲမှာ စနစ်တကျနဲ့ ပြီးအောင်လုပ်နိုင်ခဲ့တဲ့ team ကိုလဲချီးကျူးမိတယ်။</p><h4>သင်တန်းတွေအများကြီးတက်ဖြစ်တယ်</h4><p>ဒီတစ်နှစ်တော့ online မှာ သင်တန်းတွေတက်ပြီး၊ တကယ်လိုက်လုပ်ဖြစ်တဲ့နှစ်လို့ဆိုရမယ်။ အရင်ကဆို တက်တော့တက်လိုက်ပါရဲ့၊ စာတွေပုံမှန်လိုက်မလုပ်နိုင်တော့၊ အိမ်စာတွေမဖြေနိုင်တာနဲ့ ဆက်မတက်ဖြစ်တဲ့ အတန်းတွေအများကြီး။ ကျောင်းတုန်းကလို စာသင်ခန်းထဲမဖြစ်မနေ သွားထိုင်ရတာမျိုးမရှိလေတော့ ကိုယ်တိုင်စည်းကမ်းမကျပ်နိုင်ရင်မရဘူး။ စစချင်းကဆို အတွေ့အကြုံနုသေးတော့ ရင်းလိုက်ရတာတွေအများကြီးပါ။ ရုပ်ရှင်တွေကြည့်လို့မရဘူး၊ ဂိမ်း”တစ်ပွဲ”လေးဆော့ပါဦးမယ်လဲမရဘူး၊ သူငယ်ချင်းတွေက ခေါ်ရင် တစ်နာရီပါပဲဆိုတာတောင် ၁၀ ခါခေါ်မှ ၁ခါ လောက်ပဲသွားနိုင်တယ်၊ ပိုဆိုးတာကတော့ ရည်းစားက လာတွေ့ပါဆိုရင်တောင် မတွေ့နိုင်တော့တာပဲ။ အဲဒီလိုလုပ်မှ ပေးထားတဲ့ အိမ်စာတွေလုပ်နိုင်ပြီး၊ စာမေးပွဲကို ဖြေနိုင်တယ်။ ဒါပေမယ့်၊ တစ်ရက်ကို ပုံမှန် ၁ နာရီကနေ ၂ နာရီကြား သင်ခန်းစာဗီဒီယိုလေးတွေကြည့်ရုံနဲ့ရမှန်း သိလာတယ်။ အရမ်းကြီး အားစိုက်ထုတ်စရာမလိုတော့ပဲ အလေ့အကျင့်ဖြစ်သွားတယ်။</p><p>ဒီနှစ်မှာ မထင်မှတ်ဘဲ ပြီးအောင်တက်ဖြစ်တဲ့ အတန်းတွေက</p><ul><li>Artificial Intelligence (both <a href="https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-034-artificial-intelligence-spring-2005/">MIT</a> and Stanford)</li><li><a href="https://www.coursera.org/learn/machine-learning/">Machine Learning</a></li><li><a href="https://www.coursera.org/learn/neural-networks">Neural Networks for Machine Learning</a> (Feb 2017)</li><li><a href="https://www.coursera.org/learn/game-theory-1">Game Theory</a></li></ul><p>အလုပ်လိုအပ်ချက်အရမို့သာ အပြီးထိလုပ်ဖြစ်သွားတာလို့လဲထင်တာပဲ။ လေ့လာပြီးရင် ပြန်သုံးရမယ့်နေရာရှိနေတော့ အလုပ်ပိုဖြစ်ပြီး၊ ပိုလေ့လာဖြစ်တယ်။</p><h4>MyanZen အတွက် တွန်းအား</h4><p>Telenor Myanmar ကလုပ်တဲ့ပြိုင်ပွဲမှာဝင်ပြိုင်ပြီး၊ ကံကောင်းစွာနဲ့ပဲ dtac accelerate ဘန်ကောက်မှာ ၄ လ လေ့လာခွင့်ရခဲ့တယ်။ ရလာတဲ့ အကျိုးကျေးဇူးကတော့ အများကြီးပါ။ ပြိုင်ပွဲရှိကြောင်းပြောပြပေးတဲ့ သူငယ်ချင်းရဲ့ကျေးဇူးလဲ ကြီးပါတယ်။</p><p>ပြိုင်ပွဲဝင်ပြီး၊ နိုင်ခဲ့လို့သာ တွန်းအားတစ်ခုဖြစ်ခဲ့တာ။ မဟုတ်ရင်​ ဒီအချိန်မှာ အသင်းကွဲပြီး၊ ကျွန်တော်တစ်ယောက်ထဲ ဘယ်လို ဆက်လုပ်နေမလဲမတွေးတတ်ဘူး။</p><p>အကြောင်းကြောင်းကြောင့် Telenor Myanmar ရဲ့ ရင်းနှီးမြှုပ်နှံငွေကိုတော့ မယူဖြစ်ခဲ့ဘူး။</p><h4>ဘေးထွက်ဆိုးကျိုး</h4><p>အခုတော့ ကိုယ့်ရင်းနှီးငွေနဲ့ကိုယ် အချိန်တစ်ခုထိ Bootstrap လုပ်နေကြတာမလို့၊ စနောက်ပြီးပဲဖြစ်ဖြစ် funded startup ဘာညာခေါ်နေကြတာက တော်တော်ကသိကအောက်ဖြစ်ခဲ့တယ်။ အဆိုးဆုံးကတော့ CEO ဆိုတဲ့ဟာပဲ။ သူငယ်ချင်းတွေကတော့ အချင်းချင်းမလို့ စပြီးနောက်ပြီး CEO ကြီး ဘာညာ ခေါ်ကြပေမယ့်၊ အဲဒီလိုအခေါ်ခံရတာက ကျွန်တော့်အတွက်တော့ စိတ်အဆင်းရဲဆုံးကိစ္စပဲ။ ကျွန်တော်တို့ Telenor Myanmar ပြိုင်ပွဲမှာ စစချင်းပြိုင်တော့ “Who’s actually in charge?” ဆိုတာမျိုး၊ နောက်ပိုင်းမှာ တခြားလူတွေနဲ့ မိတ်ဆက်တော့လဲ သူတို့က ဘယ်သူနဲ့တိုက်ရိုက်ဆက်သွယ်ရမလဲ မသိတာမျိုးဖြစ်လာတာနဲ့ အဲဒီဟာတွေမတပ်ချင်ပဲ တပ်ထားလိုက်ရတယ်။ အရင်ကလို ကိုယ့်ယုံကြည်ချက်အတိုင်း အခေါ်အဝေါ်မရှိဘဲ ဆက်ပြီးမထားခဲ့မိတာ နောင်တအတော်ရမိတယ်။</p><h4>ဝင်ငွေရှိတုန်းက ၉၅% လောက်စုထားမိတာ မှန်သွားတယ်</h4><p>အသက်ကြီးလာတာနဲ့အမျှ ပိုက်ဆံလိုလာတယ်။ ၁၇၊​ ၁၈ အရွယ်တုန်းကဆို အိမ်က ထမင်းလဲကျွေး မုန့်ဖိုးလဲပေးတယ်။ နောက်ပြီး “စာကျက်တယ်” ဆိုတဲ့ ခေါင်းစဉ်အောက်မှာ ကိုယ်ဝါသနာပါတာလုပ်နိုင်သေးတယ်။ ကိုယ့်ပတ်ဝန်းကျင်ကရွယ်တူ သူငယ်ချင်းဆိုတာကလဲ ပိုက်ဆံအရမ်းလိုတဲ့သူဆိုတာ မရှိတတ်ဘူး။ အဲဒီတော့ ဒီအရွယ်က ရူးလို့ကောင်းတယ်။ ဝါသနာတူ သူငယ်ချင်းတွေစုပြီးပဲဖြစ်ဖြစ်၊ ကိုယ့်ကိုအခွင့်အရေးပေးမယ့် လုပ်ငန်းမျိုး၊ ပညာရမယ့်လုပ်ငန်းမျိုးမှာ ဝင်လုပ်သင့်တဲ့အရွယ်ကောင်းပဲ။ တကယ်တတ်ကျွမ်းထားဖို့လိုပြီး၊ အိပ်မက်ထဲမှာ ရပ်မနေဖို့တော့လိုတာပေါ့လေ။</p><p>အခု ကျွန်တော်တို့ ၂၄၊ ၂၅ အရွယ်မှာကြတော့ လူတိုင်းက ကိုယ်စီကိုယ်စီအကြောင်းကြောင်းနဲ့ ရပ်တည်ဖို့၊ ဘဝတည်ဆောက်ဖို့လိုကုန်ရော။ အထူးသဖြင့် တစ်ကိုယ်ထဲသမားမဟုတ်ဘဲ၊ အိမ်ရဲ့တာဝန်ကို ပုခုံးပြောင်းထမ်းရတဲ့သူတွေအတွက်က မရေရာတဲ့ အလုပ်မျိုးမှာ စုံနှစ်လိုက်ဖို့ဆိုတာ အတော်စဉ်းစားရတဲ့အခြေအနေဖြစ်သွားပြီ။</p><p>ကိုယ်ပိုင်အလုပ်လုပ်ဖို့ နောက်ကျသွားပြီဆိုတဲ့ အရွယ်မရှိပေမယ့်၊ အသက်ကြီးလာတာနဲ့ အမျှ အိပ်မက်၊ အကြံဉာဏ်၊ လုပ်ရည်ကိုင်ရည် ဆိုတာတွေနဲ့တင် လုပ်ဖော်ကိုင်ဖက်ဖြစ်လာမယ့်သူတွေကို ဆွဲဆောင်ဖို့မလုံလောက်တော့ဘူး။ ကိုယ်နဲ့စိတ်တူကိုယ်တူလိုက်ရူးနိုင်မယ့် သူငယ်ချင်းတွေရှိခဲ့မယ်ဆိုရင်တောင် ပိုက်ဆံကိုမကြည့်ပဲရူးသွပ်နိုင်မယ့် အချိန်အတိုင်းအတာဆိုတာ ကိုယ်ကော သူကောမှာ ရှိလိမ့်မယ်။ အဲဒီအချိန်အတိုင်းအတာဟာလဲ တစ်ယောက်နဲ့တစ်ယောက် တူမှာမဟုတ်တော့ ထင်သလောက်အဆင်မပြေခဲ့ရင် အချည်းအနှီးဖြစ်သွားလိမ့်မယ်။ ကိုယ့်လုပ်ငန်းကဝင်ငွေမရှိသေးရင်ဆိုတဲ့ အခြေအနေတစ်ခုကို ကြိုတွက်ပြီး၊ အခြေခံဝင်ငွေအဆင့်ကို အိတ်ထဲကစိုက်ထုတ်နိုင်ဖို့ စုဆောင်းခဲ့သင့်တယ်။ များများနဲ့ ရည်ရှည်စုခဲ့နိုင်လေကောင်းလေပဲ။</p><h4>အတွေးလွန်ခဲ့တယ်</h4><p>ကိုယ်နဲ့အတူ လိုက်ပြီးရူးသွပ်မလားဆိုတာက သူငယ်ချင်းတွေရဲ့ ဆုံးဖြတ်ချက်ပါ။ ကိုယ်ကဘာမှ မပြောကြည့်ဘဲနဲ့ ကောက်ချက်ဆွဲထားလို့မဖြစ်ဘူး။ ငါ့မှာအရင်းအနှီးလဲမရှိဘူး၊ သူတို့ကို ငါမှ ပိုက်ဆံမပေးနိုင်တာ၊ သူတို့လက်ရှိအလုပ်က လခတွေအများကြီးရနေတာပဲ၊ ငါ့အလုပ်က မအောင်မြင်ရင် သူတို့ကို အလကား ဒုက္ခတွင်းထဲ ဆွဲထည့်မိသလို ဖြစ်ပါဦးမယ်။ ဒီအတွေးတွေက တကယ့် အဆိပ်တွေ။ ကိုယ့်အလုပ်က သူတို့ကို ကိုယ်လုပ်နေတာချပြရမှာ။ ကိုယ်နဲ့အတူ ဝင်လုပ်ဖို့ ဖိတ်ခေါ်ရမှာ။ သူတို့က ကိုယ့်ကိုယုံကြည်ပြီး ကိုယ့်နောက်လိုက်လာအောင် လုပ်ပြရမှာ။ ကိုယ့်ကိုယုံကြည်ပြီး ကိုယ့်နောက်လိုက်လာတော့မှ ခုနက အတွေးလိုမျိုး အပြင်မှာ တကယ်မဖြစ်အောင်၊ တကယ်အောင်မြင်လာအောင် ဦးဆောင်ပြီး ကြိုးစားရမှာ။</p><p>တစ်ခါတစ်လေမှာ အားနာတတ်ပြီး၊ သူများဘက်ကဝင်တွေးပြီး၊ အတွေးလွန်ကောက်ချက်မဆွဲသင့်ဘူး။ ကိုယ်လုပ်စရာရှိတာ အရင်လုပ်ပြီး၊ ဆုံးဖြတ်တာကို သူတို့ဟာသူတို့လုပ်ပါစေ။ သူတို့စိတ်ထဲမှာ ကိုယ်ကတစ်စက်မှသောက်သုံးမကျဘူးဆိုရင် ဘယ်လောက်ခင်နေပါစေ၊ ပိုက်ဆံပုံအောပေးလဲ လိုက်လာမှာ မဟုတ်ဘူးလေ။</p><h4>နောင်တမရအောင်နေတယ်</h4><p>နိုဝင်ဘာတစ်လလုံး ကျန်းမာရေးတော်တော်မကောင်းဘူး။ အဆိုးထဲကအကောင်းကတော့ သေမှာမကြောက်တော့ဘူး။ ဘာမှမသိလိုက်ဘဲ သေသွားရင်အကြောင်းမဟုတ်ဘူး။ ရုတ်တရက်ဒုက္ခိတဖြစ်သွားရင်၊ ဘာမှမလုပ်နိုင်မကိုင်နိုင်ဖြစ်သွားရင် နောင်တမရနေချင်ဘူး။ ငါမလုပ်လိုက်ရလေခြင်းဆိုတာ အတော်ဆိုးမယ့် ခံစားချက်ပဲ။</p><p>အဲဒီလိုပဲ ကျန်းမာရေးကောင်းအောင် မနေခဲ့လေခြင်းဆိုတဲ့ နောင်တလဲ မရချင်လို့၊ လူလိုသူလိုဖြစ်အောင်ပြန်နေဖို့ ကြိုးစားရမယ်။</p><p>လောလောဆယ်တော့ စိတ်ဓာတ်ကျနေတာလား မသိဘူး။ စိတ်ထဲမှာ ဟာတာတာဖြစ်နေတယ်။ ကိုယ့်ကိုကိုယ် သိပ်အားမရဘူး။ ဘာမှ အဖြစ်မရှိသလို မြင်နေတယ်။ ၂၀၁၆ ကိုပြန်ကြည့်ပြီး၊ ကိုယ်လုပ်နိုင်ခဲ့တာတွေကို ချရေးလိုက်ရင် စိတ်သက်သာသွားမယ် ထင်ခဲ့တယ်။ အောက်ဘက်ရောက်လေလေ၊ မလုပ်ဖြစ်ခဲ့တာတွေ၊ မှားခဲ့တာတွေကို နောင်တရပြီး ကိုယ့်ကိုကိုယ် ဆုံးမစာလိုလိုဘာလိုလိုတွေပဲထွက်လာတယ်။ ဆက်မရေးတော့တာကောင်းမယ်…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4af2ddaf2c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swan-htet-aung/%E1%81%82%E1%81%80%E1%81%81%E1%81%86-4af2ddaf2c">၂၀၁၆</a> was originally published in <a href="https://medium.com/swan-htet-aung">SH’s Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Retrofit အလွယ်တကူ အသုံးပြုနည်း]]></title>
            <link>https://medium.com/swan-htet-aung/retrofit-%E1%80%A1%E1%80%9C%E1%80%BD%E1%80%9A%E1%80%BA%E1%80%90%E1%80%80%E1%80%B0-%E1%80%A1%E1%80%9E%E1%80%AF%E1%80%B6%E1%80%B8%E1%80%95%E1%80%BC%E1%80%AF%E1%80%94%E1%80%8A%E1%80%BA%E1%80%B8-ce230427c3d?source=rss----24905bc5e288---4</link>
            <guid isPermaLink="false">https://medium.com/p/ce230427c3d</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[retrofit]]></category>
            <dc:creator><![CDATA[Swan Htet Aung]]></dc:creator>
            <pubDate>Tue, 13 Oct 2015 09:18:48 GMT</pubDate>
            <atom:updated>2015-10-13T14:17:57.878Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Retrofit ဆိုတာနဲ့ Android application တွေရေးပြီး၊​ REST service တွေ အသုံးပြုဖူးသူဆိုရင် မသိသူမရှိသလောက် ရှားမှာပါ။ REST service တွေ android မှာ အသုံးပြုဖို့ အကောင်းဆုံး library လို့တောင်ဆိုရပါမယ်။</p><p>ဒါပေမယ့် အခုမှစလေ့လာမယ့်သူတွေ အတွက် retrofit ကို အသုံးပြုဖို့ရာ အခက်အခဲတွေ့တတ်ကြပါတယ်။ သူ့ရဲ့ ပေးထားတဲ့ ဉပမာအတိုင်းလုပ်ရင်းနဲ့ ရသွားတတ်ကြပေမယ့်၊ စနစ်မကျတာတွေ အများကြီးရှိတတ်ကြပါတယ်။</p><p>အခု ကျွန်တော်ရေးပေးမယ့် နည်းကတော့ ၂၀၁၃ နှစ်အကုန်လောက်မှာ ရေးဖြစ်ခဲ့ပြီး၊ ကျွန်တော်ကိုယ်တိုင် <a href="https://play.google.com/store/apps/details?id=co.nexlabs.hush">project</a> <a href="https://medium.com/p/ce230427c3d/edit">ပေါင်းစုံ</a>မှာရေးခဲ့တဲ့ ပုံစံပါ။ <a href="http://www.codeforchangemyanmar.org/">ပထမဆုံး Hackathon</a> မှာလည်း ကျွန်တော့်အဖွဲ့ထဲက သူတွေကို ဒီနည်းလမ်းကို စပြီး​ ပေးဖြစ်ခဲ့ပါတယ်။ နောက်ပိုင်းမှာလည်း ကျွန်တော်နဲ့ အပြင်မှာသိတဲ့သူတိုင်းကို ဒီနည်းလမ်းကို ပြောပြခဲ့ဖူးပါတယ်။</p><p>အခုမှ ဒီစာရေးရတဲ့ ရည်ရွယ်ချက်ကတော့ Retrofit အကြောင်းတင်မဟုတ်ပဲ၊ Java ရေးရာမှာ လိုက်နာသင့်တဲ့ အချက်တစ်ချို့ကိုလည်း ရေးချင်လို့ပါ။</p><p>Retrofit setup လုပ်နည်းနဲ့ သူ့ရဲ့ method တွေအကြောင်းကိုတော့ <a href="http://square.github.io/retrofit/">documentation</a> မှာပဲ သွားဖတ်ဖို့ တိုက်တွန်းပါတယ်။</p><h2>Basic Structure</h2><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*K8bGzdE0eF0XThK6.png" /><figcaption>Package Structure</figcaption></figure><p>ဒီနည်းလမ်းမှာ အဓိကအားဖြင့် client နဲ့ service ဆိုပြီး နှစ်ခုခွဲထားပါတယ်။ client မှာတော့ rest adapter တည်ဆောက်တာတွေကို လုပ်ပြီးတော့၊ REST service တွေ အကုန်လုံးကိုတော့ service interface အောက်မှာ အကုန်ထားထားပါတယ်။</p><h2>Client</h2><p>အရင်ဆုံး client ကို ဘယ်လိုတည်ဆောက်ထားလည်း​ဆိုတာ ရှင်းပြပါမယ်။</p><p>ကျွန်တော်တို့ client ကို ပုံမှန် constructor အစား အောက်ပါအတိုင်း static factory method နဲ့ တည်ဆောက်ထားပါတယ်။ ဒီနည်းလမ်းကတော့ Java မှာ အသုံးများတဲ့ နည်းလမ်းလည်းဖြစ်ပါတယ်။ သူ့ရဲ့ကောင်းကျိုးတွေကတော့</p><ol><li>constructor တွေလိုမဟုတ်ပဲ၊ နာမည်ပေးလို့ရပါတယ်။</li><li>အခါတိုင်းမှာ object အသစ်တွေ ဆောက်စရာမလိုပါဘူး​။</li><li>သူ့ရဲ့ subtype ဖြစ်တဲ့ object တွေအားလုံးကို return လုပ်ပေးနိုင်စွမ်းရှိပါတယ်။</li></ol><pre>public class MyClient {<br>  private static MyClient mInstance;</pre><pre>  // Prevent Instantiation<br>  private MyClient() {</pre><pre>  }</pre><pre>  // Start MyClient Access API //</pre><pre>  // Return instance as described by params<br>  // In the case of Singleton, take no params<br>  public static MyClient getInstance() {<br>    if (mInstance == null) {<br>      mInstance = new MyClient();<br>    }<br>    return mInstance;  <br>  }</pre><pre>  // End MyClient Access API //<br>}</pre><p>Code မှာမြင်ရတဲ့အတိုင်း ကျွန်တော်တို့ရဲ့ client ကို constructor ကနေတည်ဆောက်ခွင့်ပိတ်ထားလိုက်ပါတယ်။ အဲဒီ့နောက်မှာတော့ static factory method ဖြစ်တဲ့ getInstance နဲ့မှသာလျှင် သူ့ရဲ့ instance ကိုတည်ဆောက်ထားပါတယ်။ ဒီနေရာမှာ Java programmer တွေ သုံးနေကြဖြစ်တဲ့ အမည်ပေးနည်းလေးကိုလည်း တစ်ချက်ပြောပြဖို့လိုလာပြန်ပါတယ်။</p><blockquote>ဘာဖြစ်လဲ နာမည်ပေးတာများ ကြိုက်သလိုပေးမှာပေါ့ဆိုလဲ ရပေမယ့်၊​ ကိုယ်က တကယ် နိုင်ငံတကာနဲ့ ရင်ဘောင်တန်းမယ်ဆိုရင်၊ ကိုယ့်ရဲ့ code အရည်အသွေးဟာလည်း သူတို့နဲ့ တန်းတူရှိနေမှဖြစ်မှာပါ။</blockquote><p>instance တည်ဆောက်တဲ့ static factory method တွေကိုနာမည်ပေးကြတဲ့ အခါမှာ getInstance နဲ့ newInstance ဆိုပြီးရှိပါတယ်။</p><p>အပေါ်မှာတော့ getInstance အတွက် comment နဲ့ တစ်ခါတည်း ရှင်းပြထားပါတယ်။ ကျွန်တော်တို့ဟာ instance ကို <strong>method argument ကပေးလိုက်တဲ့အတိုင်း return ပြန်လိုက်မှာဆိုရင်တော့ getInstance</strong> ဆိုပြီး နာမည်ပေးလေ့ရှိပါတယ်။ ဒါမှမဟုတ် <strong>singleton structure နဲ့ ရေးတယ်ဆိုရင်တော့ getInstance ကိုပဲ ဘာမှမပါပဲ</strong>နဲ့ အပေါ်မှာပြထားတဲ့ အတိုင်းရေးလေ့ရှိပါတယ်။</p><p>newInstance ကတော့ getInstance လိုပါပဲ၊ ဒါပေမယ့် <strong>ကျွန်တော်တို့ရဲ့ instance တစ်ခုခြင်းစီက ထူးခြားတယ်၊ မတူညီဘူးဆိုတာသေချာတယ်ဆိုရင်တော့ newInstance</strong> နဲ့ ရေးလေ့ရှိကြပါတယ်။</p><p>Client ကို ဒီပုံစံနဲ့ ဘာကြောင့်ရေးတာလည်းဆိုတာလည်း ရှင်းပြပါမယ်။ static factory method တွေရဲ့ ကောင်းကျိုးကို အပေါ်မှာပြောပြပြီးပါပြီ၊ အဲဒီ့အထဲက နံပါတ် ၂ အချက်ကြောင့်ဖြစ်ပါတယ်။ ဒါကြောင့် ကျွန်တော်တို့ရဲ့ performance ဟာလည်း တက်လာပါလိမ့်မယ်။ <strong>REST service ဆိုတာမျိုးဟာ တစ်ခါလာ instance အသစ်တစ်ခုဆောက်ပြီး ရေးလို့ကောင်းတဲ့အရာမဟုတ်ပါဘူး။</strong> အထူးသဖြင့် memory အကန့်အသတ်နဲ့ လှုပ်ရှားနေရတဲ့ mobile အတွက် ရေးကြတဲ့ ကျွန်တော်တို့ဟာ ဒီကိစ္စကို အထူး သတိထားရမှာပါ။ နောက်ပြီး ဒီလို ရေးလိုက်တဲ့အတွက် ကျွန်တော်တို့ရဲ့ code တွေဟာ ရှင်းလင်း၊​ သပ်ရပ်သွားပြီး၊ အခါခါပြန်သုံးလို့ရသွားပါတယ်။</p><h2>Service</h2><p>ဒီကောင်ကတော့ ရှင်းပါတယ်၊ ကျွန်တော်တို့ရဲ့ client နဲ့ သက်ဆိုင်တဲ့ REST service တွေ အကုန်လုံးကို တစ်နေရာတည်းမှာ စုထည့်ပေးထားတာပါပဲ။</p><pre>public interface MyService {</pre><pre>  @Headers(&quot;Content-Type: application/json&quot;)<br>  @GET(&quot;/myobject&quot;)<br>  void getMyObjects(Callback callback);</pre><pre>  @Headers(&quot;X-app-token:some_token&quot;)<br>  @POST(&quot;/myobject&quot;)<br>  void postMyObjects(@Header(&quot;X-auth-token&quot;) String authToken, Callback callback);</pre><pre>  }</pre><p>Project တစ်ခုမှာ client တစ်ခုထက်မကရှိနိုင်ပါတယ်။ မတူတဲ့ client တွေအတွက် မတူတဲ့ service တွေရှိမှာဖြစ်ပါတယ်။</p><p>ကျွန်တော်တို့ ဒီ service ကို client မှာ အောက်ပါအတိုင်းပြန်သုံးပါတယ်။</p><pre>public class MyClient {<br>  private static MyClient mInstance;<br>  private MyService mService;</pre><pre><br>  // Prevent Instantiation<br>  private MyClient() {<br>    RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(&quot;example.com/api/&quot;).build();<br>    mService = restAdapter.create(MyService.class);<br>  }</pre><pre>  // Start MyClient Access API //</pre><pre>  // Return instance as described by params<br>  // In the case of Singleton, take no params<br>  public static MyClient getInstance() {<br>    if (mInstance == null) {<br>      mInstance = new MyClient();<br>    }<br>    return mInstance;<br>  }<br>  // End MyClient Access API //</pre><pre>  public MyService getService() {<br>    return mService;<br>  }<br>}</pre><p>Retrofit ရဲ့ RestAdapter ကို constructor ထဲမှာလိုအပ်တာ အကုန်လုံးရေးလိုက်ပါတယ်။ အဲဒီ့နောက်မှာတော့ ကျွန်တော်တို့ရဲ့ service အတွက် getter ရေးပါတယ်။</p><p>ဒါဆိုရင်တော့ ကျွန်တော်တို့ရဲ့ client code က ပြည့်စုံသွားပါပြီ။ သူ့ကို အောက်ပါအတိုင်း သေသပ်စွာ ခေါ်ယူ အသုံးပြုလို့ရသွားပါပြီ။</p><pre>MyClient.getInstance().getService().getMyObjects(new Callback() {<br>  @Override public void success(Object o, Response response) {<br>    // do something with object<br>  }</pre><pre>  @Override public void failure(RetrofitError retrofitError) {<br>    // error handling<br>  }<br>});</pre><p>ဒီနည်းနဲ့ Retrofit ကိုရေးတာဟာ အများကြီးလွယ်ကူသွားစေမယ်လို့ မျှော်လင့်ပါတယ်။ ထို့အတူပဲ Java ရဲ့ static factory method အကြောင်းကိုလည်း (အကယ်လို့ မသိခဲ့ရင်)​ နားလည်သွားလိမ့်မယ်လို့ ထင်ပါတယ်။</p><p>ကျွန်တော် အပေါ်မှာ ပြောပြခဲ့တဲ့ နည်းလမ်းကတော့ Retrofit version အဟောင်းအတွက် ရေးနည်းဖြစ်ပါတယ်။ အခုဆိုရင် Retrofit 2.0 beta ထွက်နေပြီဖြစ်ပြီး၊ သူ့အကြောင်းကိုတော့ <a href="http://www.mmaug.org/">MMAUG</a> မှာ <a href="https://medium.com/u/91e7b25d8d79">Ye Lin Aung</a> <a href="http://www.mmaug.org/retrofit-2-0-beta/">ရေးထားတာ</a>ကိုဖတ်ဖို့ တိုက်တွန်းလိုပါတယ်။</p><h4><strong>SH</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce230427c3d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swan-htet-aung/retrofit-%E1%80%A1%E1%80%9C%E1%80%BD%E1%80%9A%E1%80%BA%E1%80%90%E1%80%80%E1%80%B0-%E1%80%A1%E1%80%9E%E1%80%AF%E1%80%B6%E1%80%B8%E1%80%95%E1%80%BC%E1%80%AF%E1%80%94%E1%80%8A%E1%80%BA%E1%80%B8-ce230427c3d">Retrofit အလွယ်တကူ အသုံးပြုနည်း</a> was originally published in <a href="https://medium.com/swan-htet-aung">SH’s Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Android Screenshots]]></title>
            <link>https://medium.com/swan-htet-aung/automating-android-screenshots-5b7574c0621d?source=rss----24905bc5e288---4</link>
            <guid isPermaLink="false">https://medium.com/p/5b7574c0621d</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[uiautomation]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Swan Htet Aung]]></dc:creator>
            <pubDate>Sun, 11 Oct 2015 15:54:55 GMT</pubDate>
            <atom:updated>2015-05-09T03:02:58.449Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pS37z_bmzFcenNqGKmcWzw.jpeg" /></figure><h4>power of UI Automator</h4><p>Taking screenshots for Android apps has become super easy with the release of <a href="https://github.com/mortenjust/androidtool-mac">AndroidTool</a> for Mac. By the way, kudos to the developer! It is such an awesome tool.</p><p>For simple apps, AndroidTool is more than enough. However, I needed to automate the process of taking screenshots (<em>and publishing to play store</em>) for the apps I am currently working on. I thought that would not be easy. So, I procrastinated as much as I could to avoid doing that. 😁</p><p>While reading <a href="https://medium.com/google-developer-experts/automating-android-development-6daca3a98396">Automating Android development</a> by <a href="https://medium.com/@enriquelopezmanas">Enrique López Mañas</a> yesterday, I realised that I have already been doing 4 out of 5 topics discussed in the post. The only thing I was not doing is “Testing”. <strong><em>I was allergic to Tests</em></strong>. However, that post inspired me to try writing tests again. 😈 So, I gave it a try this morning. After a few hours of writing tests, I was accidentally implementing this working solution to automate taking screenshots.</p><p>In this article, I will talk about how to <em>automatically</em> take screenshots (<em>by writing ui tests</em>) and publish them to play store.</p><h3>UI Automator Viewer</h3><p>‘uiautomatorviewer’ is a very powerful tool to inspect views. I used to inspect how other people did awesome layouts tricks by using this tool. It is under `android-sdk/tools` directory. You will get something like this if you run it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2GVDSxydFfqY4WvXBBVQ1Q.png" /><figcaption>Starting screen of UI Automator Viewer</figcaption></figure><p>You can access UI objects through this tool. Here I can inspect id of the TextView inside the card. This technique will become useful later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9yNBO3PwetoOv7EWEChsag.png" /><figcaption>Obtained UI XML snapshot of <a href="http://www.letshush.com/">Hush</a> app.</figcaption></figure><h3>UI Automator</h3><p>Google also provides a library called ‘UI Automator’ along with <a href="https://developer.android.com/tools/testing-support-library/index.html">Android Testing Support Library</a>. It allows developers to automate user interaction to save a lot of time.</p><p>To use UI Automator, you need to add the following dependencies in your `build.gradle`.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3204ef20169459417dd20ee6be1d5ad7/href">https://medium.com/media/3204ef20169459417dd20ee6be1d5ad7/href</a></iframe><p>And as described in the <a href="https://developer.android.com/training/testing/ui-testing/uiautomator-testing.html#run">documentation</a>, you need to specify <a href="https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html">AndroidJUnitRunner</a> as the default test instrumentation runner in your `build.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89b6e4e75db9933c046905f998b39d8a/href">https://medium.com/media/89b6e4e75db9933c046905f998b39d8a/href</a></iframe><p>Classes frequently used in UI Automator are: UiDevice, UiSelector, UiObject, and UiScrollable.</p><p>We will create simple test class under androidTestScreenshot directory and extends it from InstrumentationTestCase.</p><p>The process is pretty straight forward:</p><p>First of all put the device in the Home with UiDevice’s method pressHome(). And inside each test case, we do some repetitive tasks:</p><ol><li>Open the app from start for each test case. <em>I personally find this easier to take screenshots. You can use UiDevice’s pressBack() method for other tests though.</em></li><li>Make desired UI interaction using UiSelector, UiScrollable, and UiObject.</li><li>Give some time for async tasks, that may be running behind the scene, by using `SystemClock.<em>sleep</em>`. So that we can avoid taking blank screenshots and receiving `UiObject not found` exception for scrollview items.</li><li>Finally we take screenshot and store it at a specific place.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/62ae713173e5127288ce9b92c62e505c/href">https://medium.com/media/62ae713173e5127288ce9b92c62e505c/href</a></iframe><p>By now, you might have noticed how uiautomatorviewer could help us a lot in selecting UI elements. However, I used UiSelector().resourceId because we could just use the id name we have given in our layout. It is much easier. You can use other options like className, text, etc… in selecting UI elements.</p><h3>Product Flavor</h3><p>I don’t know why but minSdkVersion for UiAutomator is 18. Since I need minSdk to be set at least 14, I have to use this extra trick. <strong><em>If there is any other way to avoid this, please do let me know.</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/06024ec4f52d56b3707d33b59cc4f690/href">https://medium.com/media/06024ec4f52d56b3707d33b59cc4f690/href</a></iframe><p>Android use androidTest directory for main test and in order to write test for different product flavors, we need to write our test under androidTestFlavorName folder. That’s why we created our SimpleUiTest class under androidTestScreenshot directory.</p><p>Everything is ready. Now, run `gradle connectedAndroidTestScreenshotDebug`. You can pull your screenshots after the test is completed.</p><h3>Bonus Tip</h3><p>The next thing you should do after automating screenshots is: <strong>Automate uploading screenshots to Play Store</strong>. You can use this awesome <a href="https://github.com/Triple-T/gradle-play-publisher">Gradle Play Publisher</a> plugin. Just follow the simple steps and BOOM, your screenshots are on Play Store.</p><p><em>As I have said earlier, I have never written tests before and this was just a simple technique I found while I tried to study how to write a test. If there is something I need to fix or improve, please let me know. I would really appreciate it.</em> — SH</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*xqYNULIc1jVxCEiEqf-fwA.jpeg" /></figure><blockquote><strong>Automate more, so you do less.<em> — </em></strong><a href="https://medium.com/@enriquelopezmanas">Enrique López Mañas</a></blockquote><p><em>Update: Someone commented on r/androiddev about </em><a href="http://flavienlaurent.com/blog/2014/12/05/screenshot_automation"><em>this awesome post</em></a><em> written by </em><a href="http://flavienlaurent.com/"><em>FLAVIEN LAURENT</em></a><em>. His post was written before the official gradle support for UIAutomator though. He explained more theory about UIAutomator. There are other useful tips like: Making Custom View accessible, cleaning the status bar with composite, etc. If you haven’t read it yet, I recommend you to read his post too.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b7574c0621d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swan-htet-aung/automating-android-screenshots-5b7574c0621d">Automating Android Screenshots</a> was originally published in <a href="https://medium.com/swan-htet-aung">SH’s Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>