<?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[Stories by Manit Cholpinyo on Medium]]></title>
        <description><![CDATA[Stories by Manit Cholpinyo on Medium]]></description>
        <link>https://medium.com/@mcnewz?source=rss-cb719d45560b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sQLmW5lefz7dNfo1UbnZSg.jpeg</url>
            <title>Stories by Manit Cholpinyo on Medium</title>
            <link>https://medium.com/@mcnewz?source=rss-cb719d45560b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 04:00:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mcnewz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Create android emulator with command line]]></title>
            <link>https://mcnewz.medium.com/create-android-emulator-with-command-line-ce7c702f877c?source=rss-cb719d45560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce7c702f877c</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[programmer]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[Manit Cholpinyo]]></dc:creator>
            <pubDate>Tue, 15 Mar 2022 16:05:31 GMT</pubDate>
            <atom:updated>2022-03-15T16:06:52.573Z</atom:updated>
            <content:encoded><![CDATA[<p>Basic create Android emulator by using command line</p><p><strong>1. Install JAVA 8 or later official release</strong></p><p><strong>2. Install Android SDK </strong><a href="https://developer.android.com/studio"><strong>https://developer.android.com/studio</strong></a></p><p><strong>3. Setup </strong><strong>ANDROID_SDK system environment variable:</strong></p><pre>export ANDROID_SDK=$HOME/Library/Android/sdk<br>export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:${ANDROID_SDK}/tools/bin:${ANDROID_SDK}/platform-tools:$PATH</pre><p><strong>4. List all android system images</strong></p><pre>sdkmanager --list | grep system-images</pre><p><strong>5. Download image Android-API version</strong></p><pre>sdkmanager --install &quot;system-images;android-31;google_apis_playstore;x86_64&quot;</pre><p><strong>6. Create an emulator</strong></p><pre>echo &quot;no&quot; | avdmanager --verbose create avd --force --name &quot;my_android_31&quot; --package &quot;system-images;android-31;google_apis_playstore;x86_64&quot; --tag &quot;google_apis_playstore&quot; --abi &quot;x86_64&quot;</pre><p><strong>7. Config your emulator (Optional)</strong></p><pre>code ~/.android/avd/my_android_31.avd/config.ini</pre><pre>PlayStore.enabled=true<br>abi.type=x86_64<br>avd.ini.displayname=Pixel 3 API 30<br>avd.ini.encoding=UTF-8<br>disk.dataPartition.size = 6442450944<br>fastboot.chosenSnapshotFile=<br>fastboot.forceChosenSnapshotBoot=no<br>fastboot.forceColdBoot=no<br>fastboot.forceFastBoot=yes<br>hw.accelerometer=yes<br>hw.arc=false<br>hw.audioInput=yes<br>hw.battery=yes<br>hw.camera.back=webcam0<br>hw.camera.front=emulated<br>hw.cpu.arch=x86_64<br>hw.cpu.ncore=4<br>hw.dPad=no<br>hw.device.hash2=MD5:8a60718609e0741c7c0cc225f49c5590<br>hw.device.manufacturer=Google<br>hw.device.name=pixel_3<br>hw.gps=yes<br>hw.gpu.enabled=yes<br>hw.gpu.mode=auto<br>hw.initialOrientation=Portrait<br>hw.keyboard=yes<br>hw.lcd.density=440<br>hw.lcd.height=2160<br>hw.lcd.width=1080<br>hw.mainKeys=no<br>hw.ramSize=1536<br>hw.sdCard=yes<br>hw.sensors.orientation=yes<br>hw.sensors.proximity=yes<br>hw.trackBall=no<br>image.sysdir.1=system-images/android-31/google_apis_playstore/x86_64/<br>runtime.network.latency=none<br>runtime.network.speed=full<br>sdcard.path=/Users/localadm/.android/avd/Pixel_3_API_30.avd/sdcard.img<br>sdcard.size=512 MB<br>showDeviceFrame=no<br>skin.dynamic=yes<br>skin.name=1080x2160<br>skin.path=_no_skin<br>skin.path.backup=_no_skin<br>tag.display=Google Play<br>tag.id=google_apis_playstore<br>vm.heapSize=256</pre><p><strong>You can config option follow this document</strong></p><p>See: <a href="https://developer.android.com/studio/run/emulator-commandline">Google Documentation on Start the emulator from the command line</a> for more info</p><p><strong>8. Open emulator</strong></p><pre>emulator @my_android_31</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*kQHdj2AIIIgwycRK4qomkg.png" /></figure><p><strong>Other commands</strong></p><ul><li>List available emulator</li></ul><pre>emulator -list-avds</pre><ul><li>Cool start emulator</li></ul><pre>emulator <a href="http://twitter.com/my_android_31">@my_android_31</a> -no-snapshot-load</pre><p><strong>Thanks :) </strong>For more information</p><p><a href="https://gist.github.com/mrk-han/66ac1a724456cadf1c93f4218c6060ae">https://gist.github.com/mrk-han/66ac1a724456cadf1c93f4218c6060ae</a></p><p><a href="https://guides.codepath.com/android/Installing-Android-SDK-Tools#installing-the-android-sdk-automated-way">https://guides.codepath.com/android/Installing-Android-SDK-Tools#installing-the-android-sdk-automated-way</a></p><p><a href="https://www.droidviews.com/install-apk-files-using-adb-commands/">https://www.droidviews.com/install-apk-files-using-adb-commands/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce7c702f877c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[การทำหน้า Settings Android เก็บข้อมูลใน Share Preferences : Part 1]]></title>
            <link>https://mcnewz.medium.com/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%97%E0%B8%B3%E0%B8%AB%E0%B8%99%E0%B9%89%E0%B8%B2-settings-android-%E0%B9%80%E0%B8%81%E0%B9%87%E0%B8%9A%E0%B8%82%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%B9%E0%B8%A5%E0%B9%83%E0%B8%99-share-preferences-395033a1deb1?source=rss-cb719d45560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/395033a1deb1</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[sharedpreferences]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Manit Cholpinyo]]></dc:creator>
            <pubDate>Sun, 16 Sep 2018 09:38:59 GMT</pubDate>
            <atom:updated>2018-09-23T11:23:46.883Z</atom:updated>
            <content:encoded><![CDATA[<p>สวัสดีครับบล็อคนี้ เป็นการแชร์ การทำหน้าจอ Settings ตั้งค่าต่าง ๆ ของ Android นะครับ โดยปกติ แอปพริเคชั่นจะมีหน้าที่ให้ตั้งค่า ฟิเจอร์ต่างๆ ให้ User จัดการตั้งค่าตามใจ ภายในแอปของเรา เช่น เปิดปิด Notification, เปิด ปิด ฟิเจอร์ บางอย่าง, การอัพโหลดข้อมูลตอน ใช้ Wifi เท่านั้น, เปิดปิดเสียง, เล่นวีดีโออัติโนมัติ, ตั้งค่าต่างๆ ฯลฯ</p><p>ทาง Android มี <a href="https://developer.android.com/reference/android/preference/Preference">Preferences</a> API ให้ใช้ ในการ สร้างหน้าจอเป็น Pattern ของ มือถือ Android ให้มีการเก็บข้อมูลใน Share Preferences โดยการเก็บข้อมูล Settings ต่างๆ ลง Local Device แต่ละเครื่อง และถ้า User มี มือถือหลายเครื่องจะต้อง ตั้งค่าแต่ละเครื่องเองหรอ ? 555 แน่นอนว่าไม่ คำตอบก็คือ ต้องทำการเก็บ ค่า Setting ไปไว้บน -Server ด้วย และเปิดเครื่องใหม่มาก็ Update ข้อมูลอีกที แต่ ในบล็อคนี้จะยังไม่เน้นเรื่องอัพโหลด ไว้บน Server จะเน้นไปในการ สร้างหน้า และ ทำการเก็บข้อมูลลง Local Device ด้วย Share preferences ก่อนซึ่ง</p><h4>ค่าที่สามารถเก็บใน Share Preferences ได้</h4><ul><li>Boolean</li><li>Float</li><li>Int</li><li>Long</li><li>String</li><li>String Set</li></ul><blockquote>your app’s settings UI is built using Preference objects instead of View objects, you need to use a specialized Activity or Fragment subclass to display the list settings</blockquote><ul><li>ถ้าแอปของเรา ใช ้Android 3.0 หรือ API level 10 หรือน้อยกว่า จะต้องใช้ <a href="https://developer.android.com/reference/android/preference/PreferenceActivity.html">PreferenceActivity</a> เท่านั้น</li><li>API ที่ใหม่กว่า &gt; 10 แนะนำให้ใช้ <a href="https://developer.android.com/reference/android/preference/PreferenceFragment">PreferenceFragment</a> หรือ จะใช้ <a href="https://developer.android.com/reference/android/preference/PreferenceActivity.html">PreferenceActivity</a> ก็ได้</li></ul><p>อ่านเพิ่มเติม</p><p><a href="https://developer.android.com/guide/topics/ui/settings">Settings | Android Developers</a></p><h4>ฟิเจอร์ในการสร้าง หน้า Settings Preference API</h4><ul><li>CheckBoxPreference</li><li>EditTextPreference</li><li>ListPreference</li><li>MultiSelectListPreference</li><li>PreferenceCategory</li><li>PreferenceScreen</li><li>SwitchPreference</li></ul><h3>ขั้นแรก สร้างหน้า Preferences in XML</h3><p>การออกแบบหน้า UI เราจะ ใช้ XML ในการกำหนดหน้าตา แต่จะใช้ Preference object ในการออกแบบ</p><h4>1. ประกาศ XML ไฟล์ ไว้ที่ (res/xml/pref_settings.xml)</h4><h4>pref_settings.xml</h4><p>สร้างหน้าจอ Settings Fragment</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3923acf35731c15c708c825028b8287d/href">https://medium.com/media/3923acf35731c15c708c825028b8287d/href</a></iframe><h4>array.xml</h4><p>Create new xml named arrays.xml (res/values/array.xml)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95245f28b2a6eea7a44fe12f7219832f/href">https://medium.com/media/95245f28b2a6eea7a44fe12f7219832f/href</a></iframe><h4>strings.xml</h4><p>Create add below string value</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0e4fc3424593168f9e065bec572a8e9/href">https://medium.com/media/a0e4fc3424593168f9e065bec572a8e9/href</a></iframe><p>เพียงเท่านี้ ก็ได้หน้า Setting มาแล้ว แต่นี้ก็แสดง แค่หน้าจอ ยังไม่ได้เรียกใช้ ต่อไปจะทำการ โหลดมาแสดงและ ทำการ เรียกใช้ข้อมูล</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*fUOM7KGIw4lFFqkb-URBbQ.png" /><figcaption>หน้าจอ Settings ที่ได้ก็สวยงาม</figcaption></figure><h4>2. สร้าง SettingsFragment.kt แสดงหน้าตา UI</h4><p>สร้าง class SettingsFragment.kt extent PreferenceFragment() เพื่อทำการโหลด XML pref_settings.xml มาแสดง</p><p>หน้าที่คลาสนี้จะทำการเขียน logic การทำงานของ แต่ละ Preference ในการ จัดการ event ต่างๆ ได้</p><pre>class <strong>SettingsFragment : PreferenceFragment()</strong>{<br>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br>        // load the preference fragment from an xml resource<br>        <strong>addPreferencesFromResource(R.xml.pref_settings)</strong><br>        ...<br>    }<br>}</pre><h4>3. สร้าง MainActivity เรียก ใช้งาน SettingsFragment.kt</h4><p>เมื่อเปิด MainActivity.kt ขึ้นมา ต้องการให้กด Menu Settings และแสดง หน้าจอ Settings โดยผ่าน ใช้ปุ่ม Menu (จุดสามจุด)</p><h4>items.xml (res/menu/items.xml)</h4><pre>&lt;menu xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;&gt;<br>    <strong>&lt;item<br>        android:id=&quot;@+id/action_settings&quot;<br>        android:orderInCategory=&quot;100&quot;<br>        android:title=&quot;@string/text_menu_setting&quot;<br>        app:showAsAction=&quot;never&quot; /&gt;</strong><br>&lt;/menu&gt;</pre><h4>activity_main.xml</h4><p>ใน activity_main.xml ประกาศ FrameLayout</p><pre>...<br>&lt;FrameLayout<br>    android:id=&quot;@+id/settings_container&quot;<br>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;match_parent&quot;/&gt;<br>...</pre><h4>MainActivity.kt</h4><p>ทำการนำค่าเซ็ตติ้งมาใช้งาน และ เมื่อมีการกดก็แสดง หน้า SettingsFragment สามารถตั้งค่าได้เลย ค่าที่ได้จะถูก เก็บไว้ใน Share Preference ทันที</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4cc34951d0e683a9faff40892ad23a8e/href">https://medium.com/media/4cc34951d0e683a9faff40892ad23a8e/href</a></iframe><ul><li>สร้างเมนู <strong>ปุ่มจุดสามจุด</strong> บนมุมบนขวาของหน้าจอ เพื่อที่จะทำการกดเข้าไปที่หน้า SettingsFragment</li></ul><pre>override fun onCreateOptionsMenu(menu: Menu?): Boolean {<br>        // Inflate the menu;<br>        <strong><em>menuInflater</em>.inflate(R.menu.<em>items</em>, menu)</strong><br>        return true<br>}</pre><ul><li>ทำการ Inflate Setting Fragment เพื่อเปิด หน้า SettingsFragment</li></ul><pre>private fun inflateSettingsFragment() {<br>        if (settingsFragment == null) {<br>            <strong>settingsFragment = SettingsFragment()</strong><br>        }<br>        val transaction: android.app.FragmentTransaction = <em>fragmentManager</em>.beginTransaction()<br>        transaction.replace(R.id.<strong><em>settings_container</em></strong>, <strong>settingsFragment</strong>, &quot;Settings Fragment&quot;)<br>        transaction.addToBackStack(&quot;Settings Fragment&quot;)<br>        transaction.commit()<br>        }<br>}</pre><ul><li>เมื่อ Activity เปิดขึ้นมาให้ initial Default Values ที่ทำการเซ็ตไว้ใน XML File <em>pref_settings เพื่อเซ็ตค่าเก็บไว้</em></li></ul><pre><strong>PreferenceManager.setDefaultValues(this, R.xml.<em>pref_settings</em>, false)</strong></pre><ul><li>เรียกคำสั่ง <strong>PreferenceManager.getDefaultSharedPreferences(this)</strong> เพื่อ ใช้ get ข้อมุล Share Perference</li><li>แต่ละ <strong>Preference </strong>เรากำหนด Key ไว้แล้ว เราสามารถ get ค่าจาก key ที่เรากำหนดไว้ได้เลย เราจะได้ Value ที่กำหนดมา</li></ul><pre>private fun showDefaultSettings() {<br>   <strong> val prefs: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)</strong><br>    val gallery = <strong>prefs</strong>.getString(getString(R.string.<em>key_gallery_name</em>), &quot;Local&quot;)<br>    mLog(gallery)<br>    val upload = <strong>prefs</strong>.getBoolean(getString(R.string.<em>key_upload_over_wifi</em>), true)<br>    mLog(upload.toString())<br>    val backup = <strong>prefs</strong>.getString(getString(R.string.<em>key_backup_frequency</em>), &quot;1&quot;)<br>    mLog(upload.toString())<br>    val notification = <strong>prefs</strong>.getBoolean(getString(R.string.<em>key_notifications_new_message</em>), true)<br>    mLog(upload.toString())<br>    val vibrate = <br><strong>prefs</strong>.getBoolean(getString(R.string.<em>key_vibrate</em>), true)<br>    mLog(upload.toString())</pre><pre>tv_gallery.<em>text </em>= &quot;Setting: \n&quot; +<br>            &quot;Default Store: $gallery \n&quot; +<br>            &quot;Auto Upload: $upload \n&quot; +<br>            &quot;Bakeup Frequency: $backup \n&quot; +<br>            &quot;Notification: $notification \n&quot; +<br>            &quot;Vibrate: $vibrate \n&quot; +<br>            &quot;&quot;<br>}</pre><ul><li>เท่านี้ ก็สามารถเรียกใช้งาน Settings พื้นฐานได้แล้ว</li><li>เอาไปกำหนด การแสดง UI ของแอปเราต่อ ในนี้คงไม่ได้บอกว่าทำยังไง แต่คงนึกภาพออก พอมีค่า ดีฟอร์ลที่เครื่องแล้วจะเรียกที่ไหนก็ได้ใน Application</li></ul><p>ตอนนี้ถ้าเรา Run ก็จะได้หน้าตา หน้า Settings ที่ สวยงามและ เรียกใช้ค่า settings ได้อย่างง่ายดาย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*3L7rwTUUkzoiSt506iEE3Q.gif" /><figcaption>แสดงข้อมูลเมื่อเปลี่ยนแปลงค่า Setting</figcaption></figure><h3>สร้าง Event และสิ่งที่ควรจะเป็น ในหน้า Settings Fragment.kt</h3><p>ในการกดปุ่มให้ และเมื่อค่าเปลี่ยนแปลงให้ทำ อะไรบ้างอย่าง เช่น เซ็ตติ้ง ตั้งค่าเสร็จให้บันถึงข้อมูล บนเซอร์เวอร์ ก็ได้เช่นกัน และสามารถ handle ปุ่มกดให้ click ได้ เหมือนกับ View ทุกประการ</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0aa86b80c38f91f364d09df89b35d7a2/href">https://medium.com/media/0aa86b80c38f91f364d09df89b35d7a2/href</a></iframe><ul><li>เราทำการ Implement 2 class เพื่อทำการ Override ในการ คลิกและ การเปลี่ยนแปลงค่าใน SharePreference</li></ul><blockquote>Preference.OnPreferenceChangeListener</blockquote><blockquote>Preference.OnPreferenceClickListener</blockquote><pre>class SettingsFragment : PreferenceFragment(),<br>        <strong>Preference.OnPreferenceChangeListener,<br>        Preference.OnPreferenceClickListener </strong>{<br>...<br>...</pre><pre>override fun <strong>onPreferenceChange</strong>(preference: Preference?, newValue: Any?): Boolean {<br>    ...<br>    return true<br>}<br><br>override fun <strong>onPreferenceClick</strong>(preference: Preference?): Boolean {<br>    ...<br>    return true<br>}<br>...<br>}</pre><blockquote>Preference.OnPreferenceChangeListener</blockquote><ul><li>เมื่อเราเปลี่ยนแปลงค่า Settings method onPreferenceChange จะทำงาน โดยเราจะจัดการให้ ข้อมูลที่เราเปลี่ยนแปลง บันทึก แสดงผล UI หรือ ทำการ เก็บขึ้น Server ก้ได้</li><li>เราจะประกาศคลาสที่เราต้องการ ให้มันทำงาน โดย <strong>findPreference </strong>ใน<strong> onCreate </strong>และระบุ key ของ Preference ที่เราตั้งไว้</li></ul><pre>override fun <strong>onCreate</strong>(savedInstanceState: Bundle?) {<br>   ...<br>    // update screen<br>    val sp = <em>preferenceScreen</em>.<em>sharedPreferences</em></pre><pre>   ...<br>    // set Preference Change Listeners<br>    val galleryNamePreference: Preference = <em>preferenceManager</em>.findPreference(getString(R.string.<em>key_gallery_name</em>))<br>    galleryNamePreference.<em>onPreferenceChangeListener </em>= this</pre><pre>    // update summary <br>    galleryNamePreference.<em>summary </em>= sp.getString(getString(R.string.<em>key_gallery_name</em>), &quot;&quot;)</pre><pre>    val uploadWifiPreference: Preference = <em>preferenceManager</em>.findPreference(getString(R.string.<em>key_upload_over_wifi</em>))<br>    uploadWifiPreference.<em>onPreferenceChangeListener </em>= this<br>    ...<br>    ...<br>}</pre><ul><li>ใน onChange เราทำการเช็ค Key และทำการ handle การทำงานต่างๆ</li><li>preference.summary = newValue.tostring อัพเดต summary description ของ ตัว preference ให้เปลี่ยนแปลงตามที่เราตั้งค่า</li><li>when (preference!!.key){...} เมื่อค่า preference มีการเปลี่ยนแปลง เราสามารถ handle ค่าต่างๆ ใน preference ตอนมันเปลี่ยนแปลงอัพเดต เช่น upload to server, หรือแสดง UI ให้ User รับรู้</li></ul><pre>override fun <strong>onPreferenceChange</strong>(preference: Preference?, newValue: Any?): Boolean {<br>    mToast(newValue.<em>toString</em>())<br>    // set text summary change ...<br>    // update screen </pre><pre>    if (preference is EditTextPreference) {<br>        if (preference.<em>key </em>== getString(R.string.<em>key_gallery_name</em>)) {<br>            <strong>preference.<em>summary </em>= newValue.<em>toString</em>()</strong><br>        }<br>    }</pre><pre>    // check key to upload to server ...<br>    <strong>when (preference!!.<em>key</em>)</strong> {<br>        getString(R.string.<em>key_gallery_name</em>) -&gt; updatePreferenceSettingSuccess(getString(R.string.<em>key_gallery_name</em>))<br>        getString(R.string.<em>key_upload_over_wifi</em>) -&gt; <strong>updatePreferenceSettingSuccess</strong>(getString(R.string.<em>key_upload_over_wifi</em>))<br>        getString(R.string.<em>key_notifications_new_message</em>) -&gt; <strong>updatePreferenceSettingSuccess</strong>(getString(R.string.<em>key_notifications_new_message</em>))<br>        getString(R.string.<em>key_notifications_new_message_ringtone</em>) -&gt; <strong>updatePreferenceSettingSuccess</strong>(getString(R.string.<em>key_notifications_new_message_ringtone</em>))<br>        getString(R.string.<em>key_vibrate</em>) -&gt; <strong>updatePreferenceSettingSuccess</strong>(getString(R.string.<em>key_vibrate</em>))<br>        getString(R.string.<em>key_backup_frequency</em>) -&gt; updatePreferenceSettingSuccess(getString(R.string.<em>key_backup_frequency</em>))<br>    }<br>    return true<br>}</pre><pre>private fun <strong>updatePreferenceSettingSuccess</strong>(key: String?) {<br>    // updates to server or anythings here<br>    mLog(&quot;updatePreferenceSettingSuccess $key&quot;)<br>}</pre><blockquote>Preference.OnPreferenceClickListener</blockquote><p>ต่อไปจำ มาดูการทำงานของการคลิ๊กบ้าง โดยเมื่อเรา คลิ๊ก เมนู <strong>My Account </strong>ทำการเปิด เปิดหน้า <strong>AccoutFragment.kt </strong>ขึ้นมา</p><ul><li>ขั้นแรก findPreference มันซะ โดย ใช้ คีย์ที่เราเซ็ตไว้กับ ปุ่มนั้น</li></ul><pre>override fun <strong>onCreate</strong>(savedInstanceState: Bundle?) {<br>   ...<br>    // set Preference Click Listeners<br>val accountPreference: Preference = findPreference(getString(R.string.<em>key_account_settings</em>))<br><strong>accountPreference.<em>onPreferenceClickListener </em>= this</strong><br>   ...<br>}</pre><ul><li>ขั้นแรก findPreference มันซะ โดย ใช้ คีย์ที่เราเซ็ตไว้กับ ปุ่มนั้น และทำไรก็เชิญ โดยในที่นี้เราจะ สั่งให้มัน เปิด AccountFragment ขึ้นมา โดย ผ่าน Interface ให้หน้า MainActivity เปิดหน้า AccountFragment</li></ul><pre>private var iItems: ItemClick? = null</pre><pre>...</pre><pre>override fun onPreferenceClick(preference: Preference?): Boolean {<br>    if (preference!!.<em>key </em>== getString(R.string.<em>key_account_settings</em>)) {<br>        // Do some things<br>        <strong>iItems!!.showAccountActivity()</strong><br>    }<br>    return true<br>}<br>...<br>...</pre><pre>override fun onAttach(context: Context?) {<br>    super.onAttach(context)<br>    iItems = (context as ItemClick)<br>}<br><br>interface ItemClick {<br>    fun showAccountActivity()<br>}</pre><ul><li>เมื่อคลิ๊ก ที่ เมนู <strong>My Account </strong>และ showAccountActivity จะทำงานและเปิด Account ให้เรา (*ต้องไปสร้าง AccountFragment.kt ไปก่อนนะ อันนี้ข้ามมา)</li></ul><pre>class MainActivity : AppCompatActivity(), SettingsFragment.ItemClick {</pre><pre>private var accountFragment: AccountFragment? = null<br>...</pre><pre>override fun <strong>showAccountActivity</strong>() {<br>    if (accountFragment == null) {<br>        <strong>accountFragment = AccountFragment()</strong><br>    }<br>    val transaction: FragmentTransaction = <em>supportFragmentManager</em>.beginTransaction()<br>    transaction.replace(R.id.<em>settings_container</em>, <strong>accountFragment</strong>, &quot;Account Fragment&quot;)<br>    transaction.addToBackStack(&quot;Account Fragment&quot;)<br>    transaction.commit()<br>}<br>...<br>}</pre><ul><li>ถึงตรงนี้ ก็สามารถ เปิด AccountFragment เปล่าๆ ขึ้นมาได้แล้ว เย่</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*wkHtYfQBOe-Ci6Lfd7obdA.gif" /></figure><h3><strong>ต่อไปทำการบันทึกข้อมูล ฟิวต่างๆ จาก Account Fragment</strong></h3><p>เราจะสร้างคลาส PreferenceHelper ที่ช่วยให้การบันทึกข้อมูลลง Share Preference ได้อย่างง่ายดาย</p><h4><strong>AccountFragment.kt</strong></h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b48dd0a1dce26b224f3aed39141433f/href">https://medium.com/media/4b48dd0a1dce26b224f3aed39141433f/href</a></iframe><h4>PreferenceHelper.kt</h4><p>เพิ่มอันนี้ไปใน project ก็สามารถทำงานได้ง่ายขึ้นเยอะ</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c89a93a17ea8881b5ea5a3b97f652467/href">https://medium.com/media/c89a93a17ea8881b5ea5a3b97f652467/href</a></iframe><ul><li>สร้าง ออบเจ็คที่ใช้เรียก Preference ในการ set, get ค่า ใน Share preference</li></ul><pre>fun defaultPrefs(context: Context): SharedPreferences<br>        = PreferenceManager.getDefaultSharedPreferences(context)<br><br>fun customPrefs(context: Context, name: String): SharedPreferences<br>        = context.getSharedPreferences(name, Context.<em>MODE_PRIVATE</em>)</pre><ul><li>สร้าง <strong>SharedPreferences.edit</strong> กลาง ที่ทำหน้าที่ เก็บข้อมูลที่ editor ต่างๆ ที่จะ สร้าง Operation และเรียกใช้ โดย edit{ it.put....(key,value) }</li></ul><pre>inline fun SharedPreferences.<strong>edit</strong>(operation: (SharedPreferences.Editor) -&gt; Unit) {<br>    val editor = this.edit()<br>    operation(editor)<br>    editor.apply()<br>}</pre><ul><li>(<strong>set value</strong>) สร้าง <strong>Operator </strong>fun<strong> SharedPreferences.set </strong>เพื่อ override method set ให้มาใช้งาน ใน Method นี้ หากทำการเรียกใช้ defaultprefs.set(key,value) method set นี้จะถูกเรียก และ ไปเรียก SharedPreferences.<strong>edit </strong>ให้<strong> </strong>editor.apply() ทำงานคือบันทักข้อมูล</li><li>การเรียกใช้งาน prefs[key] = value</li></ul><pre>operator fun <strong>SharedPreferences.set</strong>(key: String, value: Any) {<br>    when (value) {<br>        is Editable -&gt; {<br>            if (value.toString() != &quot;&quot;) {<br>                <strong><em>edit </em>{ it.putString(key, value.toString()) }<br>            </strong>}<br>        }<br>        is String -&gt; {<br>            if (value != &quot;&quot;) {<br>                <strong><em>edit </em>{ it.putString(key, value) }<br>            </strong>}<br>        }<br>        is Int -&gt; <strong><em>edit </em>{ it.putInt(key, value) }<br>        </strong>is Boolean -&gt; <strong><em>edit </em>{ it.putBoolean(key, value) }<br>        </strong>is Float -&gt; <em>edit </em><strong>{ it.putFloat(key, value) }<br>        </strong>is Long -&gt; <em>edit </em><strong>{ it.putLong(key, value) }<br>        </strong>else -&gt; throw UnsupportedOperationException(&quot;Unsupported Operation&quot;)<br>    }<br>}</pre><ul><li>(<strong>get value</strong>) สร้าง operator method generic รับ ค่า ตาม Type ตัวแปลที่ประกาศ &lt;reified T&gt; ... คือ generic type ใน Java</li><li>การเรียกใช้งาน val name: String? = prefs[key, “”]</li></ul><pre>inline operator fun <strong>&lt;reified T&gt; SharedPreferences.get</strong>(key: String, <strong>defaultValue: T? = null</strong>): T? {<br>    return when (<strong>T::class</strong>) {<br>      String::class -&gt; getString(key,<strong> defaultValue as? String</strong>) as T?<br>        Int::class -&gt; getInt(key, defaultValue as? Int ?: -1) as T?<br>      Boolean::class -&gt; getBoolean(key, defaultValue as? Boolean ?: false) as T?<br>      Float::class -&gt; getFloat(key, defaultValue as? Float ?: -1f) as T?<br>      Long::class -&gt; getLong(key, defaultValue as? Long ?: -1) as T?<br>        else -&gt; throw UnsupportedOperationException(&quot;Unsupported Operation&quot;)<br>    }<br>}</pre><h4>Constant.kt</h4><p>สร้าง key กลางไว้ใช้ อ้างอิง Preference Key</p><pre>const val <em>PREFERENCES_PROFILE_NAME </em>= &quot;new_name&quot;<br>const val <em>PREFERENCES_PROFILE_JOB </em>= &quot;new_job&quot;<br>const val <em>PREFERENCES_PROFILE_TEL </em>= &quot;new_tel&quot;</pre><p>นำค่าจาก Account Fragment มาแสดง หน้า MainActivity</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*SU1T8AnQmZLPLYWsfbygDg.gif" /></figure><p>เรียกใช้งาน Sharepreference ในหน้า Main Activity</p><pre>private fun accountSetting() {<br>    val prefs: SharedPreferences = PreferenceHelper.defaultPrefs(this)<br>    // get Value<br>    val name: String? = prefs[<em>PREFERENCES_PROFILE_NAME</em>, &quot;&quot;]<br>    val job: String? = prefs[<em>PREFERENCES_PROFILE_JOB</em>, &quot;&quot;]<br>    val tel: String? = prefs[<em>PREFERENCES_PROFILE_TEL</em>, &quot;&quot;]<br>    tv_profile.<em>text </em>= &quot;Profile: \n&quot; +<br>            &quot;$name\n&quot; +<br>            &quot;$job\n&quot; +<br>            &quot;$tel&quot;<br>}</pre><h4>สรุปเนื้อหา</h4><p>ทำการสร้างหน้าจอ Setting ด้วย Preference ออกแบบ ที่เป็นแพทเทินของแอนดรอย ได้อย่างง่ายดาย สามารถเรียกใช้งานได้ทั้งแอป เอาไปกำหนดค่า Setting ต่างๆ ภายในแอป สร้าง การตั้งค่า และเก็บข้อมูล ลง Share Preference เก็บค่าไว้ในเครื่อง การแคชข้อมูล ที่จำเป็นไว้ เพื่อที่เราไม่ต้อง โหลอข้อมูลทุกๆครั้งในการเชื่อมต่อกับ Server</p><p>การจัดการการ เปลี่ยนแปลงของ Share Preference นอกจากจะใช้ ตั้งค่าต่าง ได้แล้ว ยังเก็บค่า ส่วนอื่นๆ เรียกใช้งานเพียงแค่ Set(key,value) และ get(Key,””) ก็ได้ค่าต่างๆ ที่ทำการเก็บเอาไว้แล้วเอาไว้ง่าย</p><p>github source: <a href="https://github.com/Manit123001/Android_Settings_Preferences">https://github.com/Manit123001/Android_Settings_Preferences</a></p><p>ref</p><p><a href="https://developer.android.com/reference/android/preference/PreferenceFragment">https://developer.android.com/reference/android/preference/PreferenceFragment</a></p><p><a href="https://www.androidhive.info/2017/07/android-implementing-preferences-settings-screen/">https://www.androidhive.info/2017/07/android-implementing-preferences-settings-screen/</a></p><p><a href="https://stackoverflow.com/questions/23024831/android-shared-preferences-example">https://stackoverflow.com/questions/23024831/android-shared-preferences-example</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=395033a1deb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[วันที่ฝนตก]]></title>
            <link>https://medium.com/newzy-technologies/%E0%B8%A7%E0%B8%B1%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%9D%E0%B8%99%E0%B8%95%E0%B8%81-61fb34539b7e?source=rss-cb719d45560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/61fb34539b7e</guid>
            <category><![CDATA[inspire-new]]></category>
            <category><![CDATA[inspirtion]]></category>
            <dc:creator><![CDATA[Manit Cholpinyo]]></dc:creator>
            <pubDate>Sun, 19 Nov 2017 07:37:45 GMT</pubDate>
            <atom:updated>2017-11-19T07:38:31.481Z</atom:updated>
            <content:encoded><![CDATA[<p>ในฤดูฝน แน่ใจแค่ไหนว่าฝนจะไม่ตก ในขณะท้องฟ้ากำลังครึ้ม ทั้งๆที่ร่มก็ว่างไว้ให้เห็น….</p><p>สวัสดีผู้ที่หลงเข้ามาอ่านทุกท่านวันนี้เป็นดี อากาศแจ่มใส เหมาะแก่การนอนพักผ่อน ย่อนใจ หายใจลึกๆ และมองออกไปข้างนอกที่กว้างสุดสายตา</p><p>ของเพลงที่มีฝนหน่อย 55 ฟังเพลงนี้ละสบายใจยังไงไม่รู้ :)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXQV4ZaBJEIk%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXQV4ZaBJEIk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXQV4ZaBJEIk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c44222487c10d142c2c4c6e8ad60b211/href">https://medium.com/media/c44222487c10d142c2c4c6e8ad60b211/href</a></iframe><h4>เรื่องของร่ม</h4><p>เคยไหม เวลาออกจากบ้านแล้วเห็นร่มวางอยู่ทั้งๆที่ฟ้าครึ้มอยู่ข้างนอก เห็นๆ แต่ก็บอกกับตัวเองว่า วันนี้ฝนไม่ตกหรอก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q7V2sQJMFL6qeoim.jpg" /></figure><p>สุดท้ายพอออกไปข้างนอก ฝนก็ตกแต่ไม่ได้เอาร่มมา ถามว่า ที่คุณบอกว่าฝนไม่ตก หรอกนั้น คุณรู้ว่าฝนไม่ตกจริงๆ หรือคุณหยั่งรู้ฟ้าดิน หรือเพราะขี้เกียจจะถือร่มไปเพราะมันเกะกะกันแน่</p><p>จริงอยู่นะว่าฝนตกแล้วก็แค่เปียกมันไม่ใช่เรื่องคอขาดบาดตาย</p><p>แต่ถ้าคุณมีร่ม คุณไม่เปียกก็น่าจะดีกว่าหรอ</p><p>…</p><p>และถ้าเป็นเรื่องนี้ละ</p><p>ใบปริญญามันไม่สำคัญ ไม่อยู่ในสายตาคุณเวลานี้ แต่มีใครการันตี หรือคุณ การันตีได้แน่ๆ มั้ยว่าในอนาคตมันจะไม่ต้องใช้แน่ๆ</p><p>ใบปริญญานี้มันก็เหมือนกับร่มน่ะ เห็นอยู่ทนโท่แต่ขี้เกียจถือ เมฆครึ้มมาคืออนาคตที่คุณไม่รู้ แค่คิดเองว่ามันคงไม่ต้องใช้ไม่สำคัญ</p><p>วันที่คุณต้องใช้มันก็คือวันฝนตกนั่นล่ะ มีร่มก็กางไม่เปียก มีปริญญาอยากเปลี่ยนสายงานอยากโน่นนี่ก็ทำได้เลย แล้วปริญญาก็อีกไม่เท่าไหร่ พยายามฉวยมันมา</p><p>แต่ถ้าคุณว่ามันไม่สำคัญเหมือนที่คุณเห็นร่มไม่สำคัญก็เปียกไป หรือจะไปวิ่งมะล่อกมะแล่กหาที่หลบฝน ก็เอาที่สบายใจ</p><p>…</p><h4>ฝนตกจะไปหลบที่ไหนละ</h4><p>เรื่องของฝนคือ สิ่งที่เราต้องเจอ แต่เราจะป้องกันมันอย่างไรดี ไม่ให้เราเปียก การศึกษาก็คือการ มองว่าเป็นแค่การ สร้างร่มเพื่อป้องกันตัวเองจากฝน ตอนมันตกเราก็ไม่กลัวที่จะเดินทางไปข้างนอก</p><p>เอ๊ะ วิธีกันฝน ก็มีตั้งหลายอย่าง</p><p>มหาลัยสอนทำร่มก็มีตั้งมากมาย เราอยากได้ร่มที่ สวยงาม แข็งแรง เราก็ไปเรียนที่ที่เราเห็นเขาขายแล้ว สวยดี น่าจะเหมาะกับเรา</p><p>ร่มก็มีหลายแบบ หลายขนาด หลายรูปแบบ เราก็เลือกเรียนตาม ความชอบเลย คณะต่างๆ ก็มีร่ม ที่เหมาะกับสิ่งที่เราชอบ</p><p>เอ๊ะ ได้เรียนรู้วิธีทำร่มแล้ว</p><p>ร่มที่เราดูว่ามันสวยงามหน้าตาดี แต่พอไปเรียนทำจริงๆ ทำไมมันยากจัง เรียนอะไรเนีย เราชอบร่มแบบนี้ แต่พอทำแล้วมันไม่ถนัดเลย หึย หรือว่าเรา ชอบร่มแบบที่ง่ายกว่านี้ หรือแค่ พอใช้ก็พอ เพราะแบบสวยๆ มันยาก กว่าจะรู้ตัว… แล้วย้ายไปทำร่มอีกแบบหนึ่งก็ที่อ้ีกคณะนึงก็ เกือบสายไป แต่ยังกลับตัวทัน ไปทำร่มที่เราชอบมากกว่า</p><p>เอ๊ะ จบหลักสูตรทำร่มเป็นแล้ว หรือเปล่า?</p><p>พอทำเสร็จร่มมันเบี้ยวๆ อะ ไม่ออกมาตามต้นแบบเท่าไหร่เลย เชื่อเลย คนจบทำร่มมา ทุกคนเชื่อเลยว่าไม่ได้ดีทุกคนหรอก 555 จริง ใครจะเรียนจบมาทำเป็นเลย แต่ด้วยที่มีทักษะมาก็ ถูๆไถๆ ไปจนมีร่มไว้กันฝนใช้งานได้แล้วเย่ ส่วนเรื่องการใช้งานก็ต้องออกไปทดลองเอง ว่ามันจะดีแค่ไหน</p><p>เอ๊ะ บางคนยังไม่จบหลักสูตรทำร่มเลย</p><p>ทำไมออกไปกลางคันละ แล้วเขาก็ต้องเปียกฝนไม่สบายอะดิ แต่ทำไม บางคนก็ไปรอดบางคนก็ไม่รอด บางคนก็ใช้ร่มของคนอื่นอยู่ ขออาศัยคนอื่น ก่อนจะเดินไปต่อได้ เห้อ บางคนก็ลุยไปทั้งเปียกๆ เลย ไม่กลัว เห้ย แล้ว ไอ่คนที่ มีโรงงานทำร่มของตัวเองแต่เรียนไม่จบอะ เขาทำไง หูยสุดยอดเลย ทำไม ทำไง</p><p>เพราะเขาเจอร่มที่เขาอยากทำให้สำเร็จแล้วไงละ เขาต้องเรียนรู้เอง เจ็บเอง ต้องทำทุกอย่างเอง เรียนเอง อ่านเอง ทดลองเอง ล้มลุกคลุกคลาน แต่ใช่ว่าทุกคน ที่ทำแบบนี้แล้ว จะไปรอดทุกคน จริงไหม บางคนคิดผิดที่ออกจากโรงเรียนทำร่มกลับมาเรียนทำใหม่ บางคนสู้ทำร่มของตัวเองขายเลย บางคนก็ เรียนรู้จากความผิดพลาด เพราะต้นทุนของ เราไม่เท่ากัน โอกาสของเราไม่เท่ากัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*5ZBysoCAiyeydLfu." /><figcaption>ขอบคุณภาพ จากเพจ ผู้ชายธรรมดา</figcaption></figure><p>แล้วยังไง จะเรียนทำร่มดี หรือจะออกไปหาวิธีทำเองอ่ะ !!</p><p>บางคนใช้เวลา นับ10 20 ปีเรียนเองอย่างหนัก แต่ มันก็เต็มไปด้วยความเสียง ที่โครตจะลำบาก บางคนท้อ บางคนหมดแรงทำ แต่ก็ใช่ว่าจะไม่มีคนทำสำเร็จ แต่คิดเป็น 1% ที่จะทำได้</p><h4>แล้วจะดีกว่าไหม</h4><p>การเรียนทำร่มอ่ะ ถ้าเราตั้งใจเรียน โดยมีคนครูคอยแนะนำ และเราใช้ความทะเยอทะยานจากคนที่เขา ทำร่มเองจนยิ่งใหญ่ขายทั่วโลกอะ มาทำเป็นแรงบันดานใจเรา ในการเรียนทำร่มในมหาลัย ศึกษาจากเขา เอามาปรับใช้ในการเรียนทำร่มของ สาขาร่มที่เราเลือก มันจะลดความเสี่ยงได้มากเลย</p><p>เราใช้ข้อดีของการเรียน คนที่ทำร่มสำเร็จมาใช้ และทำมันให้เต็มที่</p><p>มีไม่น้อย คนที่เรียนทำร่มที่ โรงเรียนก็ ทำร่มขายได้อย่างยิ่งใหญ่ ไม่น้อยหน้าใคร <br>ดีกว่าไหมละ เรามีทั้ง คนที่คอยสนับสนุนสอนการทำร่มให้เรา แล้วเราก็ใช้พลังของคนที่สำเร็จมากระตุ้นเราในการที่จะสร้างร่มเป็นของตัวเอง เชื่อดิ มันคุ้มค่ากว่ามากเลย เพราะโอกาส ที่เราจะเรียนรู้วิธีสร้างร่มที่ถูกวิธีจาก โรงเรียน แล้วความฝันความทะเยอทะยานจากคนระดับเทพ มาเป็นแรงบันดาลใจให้เรา ตั้งใจทำเร่มที่เป็นของเรา แล้วเอาทักษะนี้ไปปรับใช้กับการทำงาน ต่างๆเพื่อให้ได้ร่มที่สุดยอด</p><blockquote>อดทนเวลาที่ฝนพร่ำอย่างน้อยก็ทำให้เห็นถึงความแตกต่าง</blockquote><p>เราไม่ต้องรีบที่จะรอให้ฝนหยุดตกแล้วทำตามเป้าหมาย แต่ถึงอย่างไร ถึงแม้เราจะหลบฝนอยู่เราก็ถึงเป้าหมายได้</p><p>ถ้าเรารู้ตัวเอง ว่าเราจะทำอะไร ร่มที่เราทำ มันจะพัฒนาขึ้นและแข็งแรงขึ้น โดยเราจะเรียนรู้มันได้เองจากการใช้งานมัน และเมื่อมันไม่ดีตรงไหน เราก็ซ่อมมันได้ และทำมันให้ดีที่สุดได้</p><p>มันจะยากๆ ตอนแรกจากวันที่เราออกจาก โรงเรียนทำร่ม แต่เชื่อเถอะ ถ้าเรา อดทน เรียนรู้จากสิ่งต่างๆ ความผิดพลาดจะสอนเราเอง และรู้ไว้เลย ร่มที่เราทำ จะดีขึ้นทุกวัน</p><blockquote>เมื่อวันเวลาที่ฝนจาง ฟ้าก็คงสว่างและทำให้เราได้เข้าใจว่ามันคุ้มค่าแค่ไหนที่เฝ้ารอ</blockquote><p>ฝนไม่ได้ ตกทั้งชีวิต เปรียบเสมือน ความลำบากที่เรากำลังคิดว่ามันยาก มันไม่ได้สักที เราจะทำได้ไหม เชื่อในคำว่า <strong>“ไม่มีคำว่าตลอดไปจากอะไรทั้งนั้น”</strong> ไม่มีใครที่จะจนตลอดไป ไม่มีคนที่จะโชคดีตลอดไป ไม่มีใครที่จะโง่ตลอดไป ไม่มีใครจะฉลาดตลอดไป ไม่มีใครที่จะหนุ่มตลอดไป</p><blockquote>ทุกๆ อย่างเป็นไปตามเวลาของมัน ณ จุดที่เราอยู่ เราทำอะไรกับมันสำคัญที่สุด</blockquote><p>เชื่อสิ ว่าเราทำร่มที่ดีได้ ถ้าคนอื่นทำได้ เราก็ทำได้ เพียงแค่ศึกษา และลงมือทำ วิธีการตามนั้นก็จะได้ตามนั้นเหละ</p><p>และฝน ก็ไม่ได้ตกแค่ ฤดูฝัน วันนี้ก็จะหนาวอยู่ละ ก็ตกอีกละ เซง 5555</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S1Rb6h_9EcBxc-VZ.jpg" /><figcaption>ขอบคุณภาพจาก อินเตอร์เนต</figcaption></figure><p>เป็นแค่การแชร์ความคิดส่วนตัว ผิดพลาดประการใดก็ขออภัยด้วย</p><p>ขอบคุณ เนื้อหาบางอันเราอ่านเจอจาก facebook จากอินเตอร์เน็ต , Warod Hotarapavanon จากเพื่อนในเฟสบุ๊ค จากคนใกล้ชิด บ้าง เพื่อนบ้าง ขออนุญาติ ใช้นะ ครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61fb34539b7e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/newzy-technologies/%E0%B8%A7%E0%B8%B1%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%9D%E0%B8%99%E0%B8%95%E0%B8%81-61fb34539b7e">วันที่ฝนตก</a> was originally published in <a href="https://medium.com/newzy-technologies">NEWZY Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ดึงต้นกล้าให้โต]]></title>
            <link>https://mcnewz.medium.com/%E0%B8%94%E0%B8%B6%E0%B8%87%E0%B8%95%E0%B9%89%E0%B8%99%E0%B8%81%E0%B8%A5%E0%B9%89%E0%B8%B2%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B9%82%E0%B8%95-90a3d27cbedb?source=rss-cb719d45560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/90a3d27cbedb</guid>
            <category><![CDATA[inspiration]]></category>
            <category><![CDATA[mcnewz]]></category>
            <category><![CDATA[inspire-new]]></category>
            <dc:creator><![CDATA[Manit Cholpinyo]]></dc:creator>
            <pubDate>Fri, 17 Nov 2017 18:16:37 GMT</pubDate>
            <atom:updated>2017-11-19T05:46:29.693Z</atom:updated>
            <content:encoded><![CDATA[<p>สวัสดีผู้ที่หลงเข้ามาอ่านทุกท่าน</p><p>รู้มั้ย ว่าทุกอย่างรอบๆตัวเรามันโตตลอดเวลา และไม่มีอะไรรีบเร่งเลย มันโตทุกๆวัน ต้นไม้ที่เราปลูกมันโตทุกวัน แมวหมาที่เราเลี้ยงก็โตขึ้นทุกวัน ต้นมะม่วงหลังบ้านก็โตข้ามวันข้ามคืน กล้วยที่ปลูกก็ใกล้จะสุกพร้อมกินแล้ว ลูกของเราก็โตขึ้นทุกๆวัน เราเองก็มี การเปลี่ยนแปลงของมัน ตลอดเวลา</p><p>เอ๊ะ มันมีวิธีทำให้โตเร็วๆไหมน๊า พรุ่งนี้ทำให้มันโตได้เลยไหม สมมุติ อยากกินมะม่วงแล้วเราอยากให้พรุ่งนี้สุกเลยได้ไหม</p><p>555</p><p>อาจจะมีก็ได้ แต่ก็วิธีที่ผิดธรรมชาติ อาจจะโตเร็ว แต่มันจะอร่อยรึเปล่า ไม่รู้ เพราะฉะนั้นแล้ว ไม่ม่ีอะไรจะดีไปกว่ารอให้มันสุกเอง จะอร่อยที่สุด เน้อ</p><h4><strong>คุณรู้จักการอคอยไหม</strong></h4><p>การรอคอยคืออะไร : ก็รอไง ก็เหมือนรอ รถเมย์เหละ รอคิวไง รอแฟน รอเลิกงานไง 555 รอ รอ เอ๊ะ</p><p>แต่การรอ คำสั้นๆ แต่มันคือจุด ที่ทำให้ทุกคนต่างกัน อ่าวจะต่างกันยังไง ทุกคนก็รอเท่ากัน มาก่อนก็ได้ก่อน มาช้าก็ต่อคิว 5555 ตามระบบที่วางไว้แล้ว อะไรละที่ต่าง</p><h4>เดะเล่าให้ฟัง</h4><p>รอคอย : การรอคอยไม่ใช่การเฝ้ารอผลโดยไม่ลงมือ ขวนขวาย หรือนั่งงอมืองอเท้าและไม่ใช่การด่าว่าผู้อื่นหรือเอ้อระเหย ไม่ทำอะไรเลย เพราะว่า ดอกไม้และเสียงปรบมือเป็นของคนที่รู้จักเตรียมตัว มันต้องการสอนพวกเราว่าระหว่างที่รอคอย ต้องเรียนรู้ที่จะพิจารณาและประเมินการเปลี่ยนแปลงของสถานการ์ นั้นๆและตัดสินใจที่จะทำอะไรอย่างมีเหตุมีผล….</p><p>ในชีวิตของเรา บ่อยครั้งที่ต้องรอคอย รอคอยการเติบโต รอคอยเพื่อยอมรับสิ่งต่างๆ รอคอยเรื่องเรื่องหนึ่งให้สำเร็จ และก็มีจินตนาการต่างๆ ที่ต้องการจะให้เป็นจริง</p><p>เพราะว่าทุกๆ สิ่งล้วนแต่มีกฎเกณฑ์ในการพัฒนาของมัน</p><p>…</p><p>…</p><p>…</p><p>ชายหนุ่มคนหนึ่งนัดพบกับคนรักของเขา เขามาเร็วกว่าเวลานัดหมาย และด้วยความที่ตนเองเป็นคนไม่อดทน จึงไม่มีกะจิตกะใจไปชมความงามของแสงอาทิตย์ ทัศนียภาพในฤดูใบไม้พลิที่ ทำให้ผู้คนหลงไหล หรือแม้แต่ดอกไม้ที่งดงาม</p><p>เขาได้แต่ยืนอยู่ที่จุดนัดพบอย่างกระสับกระส่าย เอาแต่คร่ำครวญถอนใจ</p><p>ในตอนนั้นมีผู้อาวุโสคนนึ่งปรากฏตัวขึ้นตรงหน้าเขา พร้อมกับกล่าวว่า “ข้ารู้ว่าทำไมเจ้าถึงไม่มีความสุข ใส่นาฬิกาเรือนนี้สิ เมื่อเจ้าพบกับเรื่องที่ต้องรอคอย หมุนเวลาเรือนนี้ไปหนึ่งรอบก็จะข้ามเวลาช่วงนั้นไปได้ อยากจะให้เวลานั้นผ่านไปนานแค่ไหนก็ได้” ใบหน้าของชายหนุ่มเปรี่ยมไปด้วยรอยยิ้ม เขารับนาฬิกาจาก ผู้อาวุโส จากนั้นผู้อาวุโสก็หายไป</p><p>ชายหนุ่มใส่นาฬิกาข้อมือ จากนั้นก็ลองหมุนเวลาไปหนึ่งรอบ คนรักของเขาก็ปรากฏตัวขึ้นตรงหน้า เขาลองคิดดู</p><p>หากตอนนี้จัดพิธีแต่งงานก็คงจะดีไม่น้อย ดังนั้นจึงหมุนเวลาไปอีกรอบ ภาพของพิธีแต่งงานที่ใหญ่โต และงานเลี้ยงที่เต็มไปด้วยอาหารมากมายหลากหลายก็ปรากฎขึ้นอยู่ตรงหน้า เขาและเจ้าสาวแสนสวยในชุดแต่งงานสีขาวราวกับหิมะทั้งชุดกำลังรับคำอวยพรจากเพื่อนๆ ความใฝ่ฝันในใจของเขาผุดขึ้นไม่หยุด</p><p>รีสอร์ตที่หรูหรา ลูกที่แข็งแรง รถยนต์ราคาแพงลิบ</p><p>เขารอต่อไปไม่ไหวแล้วจึงรีบหมุนนาฬิการอบแล้วรอบเล่า เขาคิดถึงผลลัพธ์ที่จะเกิดขึ้นตามมาไม่ทัน ชีวิตของชายหนุ่มผ่านไปอย่างรวดเร็ว สุดท้ายก็พบว่าตนเองแก่และร่างกายอ่อนแอลง แถมยังนอนอยู่บนเตียงคนไข้</p><p>สิ่งเดียวที่เฝ้ารอก็คือการมาเยือนของัจจุราช พอถึงเวลาที่ใกล้จะจากโลกนี้ไป เขาถึงได้รู้และเข้าใจความหมายของการ “รอคอย”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*WP03lzM8FWyZLOjrhXTD8w.png" /><figcaption>internet <a href="https://www.istockphoto.com/th/photos/hourglass?excludenudity=true&amp;sort=mostpopular&amp;mediatype=photography&amp;phrase=hourglass">https://www.istockphoto.com/th/photos/hourglass?excludenudity=true&amp;sort=mostpopular&amp;mediatype=photography&amp;phrase=hourglass</a></figcaption></figure><p>สิ่งต่างๆ บนโลกทุกๆ สิ่งมีหลักการการเติบโตที่เหมือนๆๆ กันคือโตขึ้นทุกวัน และไม่ต้องมีข้อสงสัยว่าจะรออะไร เมื่อไหร่จะถึงลืมไปได้เลย จงอยู่กับปัจจุบันของเรา ทำสิ่งที่มีค่าที่สุดตรงหน้าของเรา ครอบครัวพ่อแม่ เพื่อนฝูง เพื่อนร่วมงาน ญาติพี่น้อง ลูกหลาน สัตว์เลี้ยง เส้นทางที่ยาวไกล ก็ยังมีสิ่งที่อยู่ข้างทางให้ชื่นชม</p><p>ความสำเร็จไม่ใช่จะได้มาง่ายๆ ก่อนที่คนเราจะประสบความสำเร็จอะไรก็แล้วแต่ จึงต้องเรียนรู้ที่จะรอคอย ดังเช่น ผีเสื้อหนอนที่ต้องออกจากดักแด้ใช้เวลา 35 วัน ก่อนจะเป็นลูกแอปเปิ้ลรอประมาณ 150 วัน น้ำแข็งที่เกาะตัวแข็งเป็นเกราะ ไม่ได้แข็งในวันเดียว น้ำเซาะจนหินกร่อนไม่ได้ เกิดขึ้นใน 1 วัน</p><p>ไม่ว่าเรื่องใดล้วนมีกฎเกณฑ์การพัฒนาตามธรรมชาติของมัน เพียงแค่เราเดินตามกฎเกณฑ์นั้นก็จะก้าวไปสู้ความสำเร็จได้ หากไม่อดทน ไม่รอคอย ก็จะเป็นการเร่งรีบจนเกินไป ทำให้ไปไม่ถึงเป้าหมาย หากเรียนรู้ที่จะรอคอย ทุกสิ่งที่เป็นของเราก็จะมาได้ทันเวลา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*0ErAKNry0qRNkSq_.jpg" /><figcaption>image from internet</figcaption></figure><blockquote>อย่าดึงต้นกล้าให้โต</blockquote><blockquote>มันจะโตเป็นต้นที่ใหญ่ด้วยตัวเอง และเราก็ต้อง ใส่ปุ๋ย รดน้ำ มันให้ดีที่สุด สุดท้ายต้นกล้าก็จะเป็นต้นไม้ใหญที่มีคุณค่า</blockquote><p>…</p><p>…</p><p>Thanks<br>From Book : You in the future must thank myself that fight to day</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90a3d27cbedb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thread base of Fundamental Android developer]]></title>
            <link>https://medium.com/newzy-technologies/thread-base-of-fundamental-android-developer-3c1aad24c989?source=rss-cb719d45560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c1aad24c989</guid>
            <category><![CDATA[devnews]]></category>
            <category><![CDATA[java-news]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Manit Cholpinyo]]></dc:creator>
            <pubDate>Fri, 17 Nov 2017 16:58:08 GMT</pubDate>
            <atom:updated>2018-01-12T10:21:45.378Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Thread by The cheese Factory</strong></p><p>I’m do this for make myself to only remember</p><p>Thread is very important in any mobile, No matter what Android &amp; IOS</p><p><strong>Because Mobile have been limited of resource<br></strong>Limited CPU<br>Limited Battery</p><blockquote>Only few of developers master Threading<br>You Have to master Threading if you want to be a mobile developer</blockquote><p><strong>Actually you have already had experience with Thread<br></strong>- Loading data from server with <strong>Retrofit<br></strong>- Loading image from server with <strong>Glide</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*rwAP3nRAvELlX6UqBI3_Wg.png" /><figcaption>App might catch cr image the cheese factory</figcaption></figure><ol><li>Reception = <strong>Main Thread </strong>-&gt; work with one Application only.</li><li>Teelek =<strong> Background Thread</strong> -&gt; Work instant main thread.</li></ol><p><strong>When seperate job to a Background Thread<br></strong>= 60 fps (16.67ms/1job)</p><p><strong>Small job </strong>-&gt; Run on Main thread<br><strong>Expensive job</strong> -&gt; Run on Background Thread</p><pre><em>/**<br> * Thread Method 1: Thread (Not Use this thread)<br> **/</em></pre><pre><em>/**<br> * Thread Method 2 : Thread with Handler (Use This Solution<br> **/</em></pre><pre><em>/**<br> * Thread Method 3 : Handler Only (Work instand thread)<br> **/</em></pre><pre><em>/**<br> * </em>Thread Method 4: HandlerThread (2 3 combined)<em><br> **/</em></pre><pre><em>/**<br> * </em>Thread Method 5:   Thread Method 5: AsyncTask<em><br> **/</em></pre><pre><em>/**<br> * </em>  Thread Method 6: AsyncTaskLoader<em><br> **/</em></pre><h4>AsyncTask</h4><p>It can work just 1 time if it have multi asynctask , it’s work follow queue</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*E5E0JvIta-o3xr7zXkiDmg.png" /><figcaption>the cheese factory</figcaption></figure><p>How to run multi AsyncTask</p><pre>sampleAsyncTask.executeOnExecutor(AsyncTask.<em>THREAD_POOL_EXECUTOR</em>, 0, 100);</pre><blockquote><strong>AsyncTask is made for “Very short Task” (&lt; 5 seconds)</strong></blockquote><blockquote><strong>AsyncTask Concept<br>Short Operations Publish Result on the UI Thread.</strong></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69c1748f1f282419372b4b7a04762a25/href">https://medium.com/media/69c1748f1f282419372b4b7a04762a25/href</a></iframe><p><a href="https://nuuneoi.com/blog/blog.php?read_id=781">NuuNeoI - สารพันเรื่องราวของ &quot;Thread&quot; บนแอนดรอยด์ การปะทะกันของ Thread, AsyncTask, AsyncTaskLoader และ IntentService</a></p><p>cr nuuneoi</p><p><strong>Thanks,<br>best regard</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c1aad24c989" width="1" height="1" alt=""><hr><p><a href="https://medium.com/newzy-technologies/thread-base-of-fundamental-android-developer-3c1aad24c989">Thread base of Fundamental Android developer</a> was originally published in <a href="https://medium.com/newzy-technologies">NEWZY Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Collection]]></title>
            <link>https://medium.com/newzy-technologies/java-collection-f87237da3b5d?source=rss-cb719d45560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f87237da3b5d</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[devnews]]></category>
            <category><![CDATA[collection]]></category>
            <dc:creator><![CDATA[Manit Cholpinyo]]></dc:creator>
            <pubDate>Fri, 17 Nov 2017 16:45:40 GMT</pubDate>
            <atom:updated>2017-11-19T04:58:02.847Z</atom:updated>
            <content:encoded><![CDATA[<p>basic java collection, short explain</p><p>Basic of Java Collection is a base of developer in java While it’s importent almost because It’s manage data in array and adapt to your project so easy use any data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*8xvUkJTWCF-gSIU0ywAjxA.png" /><figcaption><a href="https://www.javatpoint.com/collections-in-java">https://www.javatpoint.com/collections-in-java</a></figcaption></figure><ol><li><a href="https://www.javatpoint.com/java-arraylist">ArrayList class</a></li><li><a href="https://www.javatpoint.com/java-linkedlist">LinkedList class</a></li><li><a href="https://www.javatpoint.com/java-list">List interface</a></li><li><a href="https://www.javatpoint.com/java-hashset">HashSet class</a></li><li><a href="https://www.javatpoint.com/java-linkedhashset">LinkedHashSet class</a></li><li><a href="https://www.javatpoint.com/java-treeset">TreeSet class</a></li><li><a href="https://www.javatpoint.com/java-priorityqueue">PriorityQueue class</a></li><li><a href="https://www.javatpoint.com/java-map">Map interface</a></li><li><a href="https://www.javatpoint.com/java-hashmap">HashMap class</a></li><li><a href="https://www.javatpoint.com/java-linkedhashmap">LinkedHashMap class</a></li><li><a href="https://www.javatpoint.com/TreeMap-class-in-collection-framework">TreeMap class</a></li><li><a href="https://www.javatpoint.com/Hashtable-class-in-collection-framework">Hashtable class</a></li><li><a href="https://www.javatpoint.com/Sorting-in-collection-framework">Sorting</a></li><li><a href="https://www.javatpoint.com/Comparable-interface-in-collection-framework">Comparable interface</a></li><li><a href="https://www.javatpoint.com/Comparator-interface-in-collection-framework">Comparator interface</a></li><li><a href="https://www.javatpoint.com/properties-class-in-java">Properties class in Java</a></li></ol><p><strong>Arraylist : flixible to store data and get data so easy<br>LinkList: easy to add remove <br>HashSet Set contains unique elements only.<br>Sorting: sorting the elements of collection<br>Maps : store data by Key and Value</strong></p><h3>Array list</h3><p>Array list is a Collections that keep data as normally array but the think that different is Arraylist It can reduce and enlarge automaticly follow data inside that make is flixible for working because don’t declare max size forword with normal Array</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*C5jfNWzl-KK7Qiqua4Rt8g.png" /></figure><pre>import java.util.ArrayList;<br><br>public class ArrayListExample {<br><br>    public static void main (String[] args) {<br>        <br>        ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt;();<br>        names.add(&quot;Mateo&quot;);<br>        names.add(&quot;Danny&quot;);<br>        names.add(&quot;Joe&quot;);<br>        names.add(&quot;Alex&quot;);<br>        <br>        System.out.println(names.size() + &quot; people in the list&quot;);<br>        <br>        // Access list through  it index<br>        System.out.println(&quot;name[0] = &quot; + names.get(0));<br>        System.out.println(&quot;name[3] = &quot; + names.get(3));<br>        <br>        // Iterate through ArrayList usign foreach<br>        for (String name: names) {<br>            System.out.print(name + &quot; &quot;);<br>        }<br>        System.out.println();<br>        <br>        // Iterate through ArrayList using index (reverse)<br>        for (int i = names.size() - 1; i &gt;= 0; i--) {<br>            System.out.print(names.get(i) + &quot; &quot;);<br>        }<br>        System.out.println();<br>        <br>        // Check if the list contain Mateo<br>        if (names.contains(&quot;Mateo&quot;)) {<br>            System.out.println(&quot;Mateo is in the list&quot;);<br>        } else {<br>            System.out.println(&quot;Mateo is not in the list&quot;);<br>        }<br>        <br>        // Get Danny&#39;s index<br>        int dannyIndex = names.indexOf(&quot;Danny&quot;);<br>        System.out.println(&quot;Index of Danny is &quot; + dannyIndex); <br>        // Change Danny to Max<br>        names.set(dannyIndex, &quot;Max&quot;);<br>        <br>        // Remove joe from the list<br>        names.remove(&quot;Joe&quot;);<br>        <br>        // Iterate through ArrayList usign foreach<br>        for (String name: names) {<br>            System.out.print(name + &quot; &quot;);<br>        }<br>        System.out.println();<br>        <br>        // Clear all list data<br>        names.clear();<br>        <br>        if(names.isEmpty()) {<br>            System.out.println(&quot;List is now empty&quot;);<br>        }<br><br>    }<br><br>}</pre><h3>Maps</h3><p>Maps is a Coolection that have a pattern store that is Key Value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*-1EBZBQKii6KSM-m9j2qyg.png" /></figure><pre>import java.util.HashMap;<br><br>public class HashMapExample {<br>    <br>    public static void main (String[] args) {<br>        <br>       HashMap&lt;String, String&gt; country = new HashMap&lt;&gt;();<br>       country.put(&quot;de&quot;, &quot;German&quot;);<br>       country.put(&quot;th&quot;, &quot;Thailand&quot;);<br>       country.put(&quot;us&quot;, &quot;United State&quot;);<br>       country.put(&quot;tr&quot;, &quot;Turkey&quot;);<br>       <br>       System.out.println(&quot;Map size = &quot; + country.size());<br>       <br>       System.out.println(&quot;de = &quot; + country.get(&quot;de&quot;));<br>       System.out.println(&quot;th = &quot; + country.get(&quot;th&quot;));<br>       System.out.println(&quot;th = &quot; + country.get(&quot;uk&quot;));<br>       <br>       System.out.println(&quot;Iterate over each Entry in HashMap&quot;);<br>       for (HashMap.Entry&lt;String, String&gt; entry : country.entrySet())<br>       {<br>           System.out.println(entry.getKey() + &quot; = &quot; + entry.getValue());<br>       }<br>       <br>       country.remove(&quot;tr&quot;);<br>       if(country.containsKey(&quot;tr&quot;)) {<br>           System.out.println(&quot;Turkey exist in the map&quot;);<br>       } else {<br>           System.out.println(&quot;Turkey does not exist in the map&quot;);<br>       }<br>       <br>       country.clear();<br>       System.out.println(&quot;Map size = &quot; + country.size());<br>            <br>    }<br>}</pre><h3>Stack</h3><p>Stack is structor of data that use store data by Pattern <strong>First in last out</strong>, data will be put to stack first to it’s removed later that is only push data one way for working with Stack when we put data in to Stack it’s called <strong>Push </strong>and when bring data out from stack it’s called <strong>Pop</strong></p><pre> import java.util.Stack;<br><br>public class StackExample {<br>    <br>    public static void main (String[] args) {<br>        <br>        Stack&lt;String&gt; fruit = new Stack&lt;&gt;();<br><br>        // Add four fruits to stack<br>        fruit.push(&quot;Apple&quot;);<br>        fruit.push(&quot;Banana&quot;);<br>        fruit.push(&quot;Melon&quot;);<br>        fruit.push(&quot;Peach&quot;);<br>        <br>        System.out.println(&quot;Pop &quot; + fruit.pop() + &quot; from stack&quot;);<br>        System.out.println(&quot;Pop &quot; + fruit.pop() + &quot; from stack&quot;);<br>        System.out.println(&quot;Pop &quot; + fruit.pop() + &quot; from stack&quot;);<br>        System.out.println(&quot;Pop &quot; + fruit.pop() + &quot; from stack&quot;);<br>        <br>        if (fruit.isEmpty()) {<br>            System.out.println(&quot;Stack is empty&quot;);<br>        }<br>        <br>    }<br>}</pre><p><a href="https://www.javatpoint.com/collections-in-java">Collections in Java - javatpoint</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f87237da3b5d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/newzy-technologies/java-collection-f87237da3b5d">Java Collection</a> was originally published in <a href="https://medium.com/newzy-technologies">NEWZY Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is a Big O Notation]]></title>
            <link>https://medium.com/newzy-technologies/what-is-a-big-o-notation-597cad55d427?source=rss-cb719d45560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/597cad55d427</guid>
            <category><![CDATA[devnews]]></category>
            <category><![CDATA[big-o-notation]]></category>
            <dc:creator><![CDATA[Manit Cholpinyo]]></dc:creator>
            <pubDate>Mon, 13 Nov 2017 03:32:08 GMT</pubDate>
            <atom:updated>2017-11-19T04:55:30.872Z</atom:updated>
            <content:encoded><![CDATA[<p>Big O Notation short explain</p><p><strong>Definition of Math line</strong></p><blockquote>f(x) = O(g(x)) as x -&gt; ∞</blockquote><p><strong>Definition of Computer line</strong></p><blockquote>Big O Nation is worst time or the area which most processors. The computer must be paid to run the algorithm or the complexity of algorithm</blockquote><p>For example, there is an array containing 10 unique name ( we have our own name). Let’s say we want to find a name for ourselves. We need to loop to find the righ one. If we are lucky We are in the first position. It take about 1 loops, but unfortunately … To the last position It takes about 10 loops to find what you want. The worst case is that we are interested and call it Big O Nation.</p><p>Data 1–10 is not different, If the amount of data increased by 1M+, then we unfortunately have the worst case. the computer it loops around a million of them. But we can reduce the chance of it happening Using Big O Notation analysis.</p><h3><strong>Types of Big O Notation</strong></h3><p>There are about 8 types. The Big O Notation called O(n) When n is the number of inputs in our algorithm. Big O Notation focuses on the subject. Processing time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*-dFpURcG9Qzv0ZzJ0U8oCQ.png" /></figure><p>O(1) or Constant</p><p>O(log n) or logarithmict</p><p>O(n log n) or linearithmic</p><p>O(n²) or quadratic</p><p>O(n³) or cubic</p><p>O(2^n)or exponential</p><p>O(!n) or factorial</p><ul><li><a href="https://itopstory.com/what-why-and-type-big-o-notation-90a1a1d43596">Big O Notation สำคัญไฉน มาทบทวนกันหน่อย (Part 1) — ความหมาย และประเภทของ Big O</a></li><li><a href="http://bigocheatsheet.com/">Know Thy Complexities!</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=597cad55d427" width="1" height="1" alt=""><hr><p><a href="https://medium.com/newzy-technologies/what-is-a-big-o-notation-597cad55d427">What is a Big O Notation</a> was originally published in <a href="https://medium.com/newzy-technologies">NEWZY Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[คิดอย่างคนรวย]]></title>
            <link>https://mcnewz.medium.com/%E0%B8%84%E0%B8%B4%E0%B8%94%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B8%84%E0%B8%99%E0%B8%A3%E0%B8%A7%E0%B8%A2-3fdd33543170?source=rss-cb719d45560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fdd33543170</guid>
            <category><![CDATA[inspiration]]></category>
            <category><![CDATA[inspire-new]]></category>
            <dc:creator><![CDATA[Manit Cholpinyo]]></dc:creator>
            <pubDate>Sun, 15 Oct 2017 06:59:40 GMT</pubDate>
            <atom:updated>2017-11-19T04:53:55.581Z</atom:updated>
            <content:encoded><![CDATA[<p>คนรวยไม่ใช้ทุนที่หามาได้ ซื้อของที่ต้องการ แต่จะเอาไปสร้าง เงินฟรี ไปซื้ออีกที</p><p>คนรวยสร้างทรัพย์สิน</p><p>คนรวยใส่ให้ตัวเอง</p><p>คนรวยจ้างคนที่เก่งกว่าทำให้ตัวเองรวย</p><p>คนรวยคือคนที่มีอิสระทางการเงิน</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fdd33543170" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[จุดเริ่มต้น คิดแบบคนรวย]]></title>
            <link>https://mcnewz.medium.com/%E0%B8%88%E0%B8%B8%E0%B8%94%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%95%E0%B9%89%E0%B8%99-%E0%B8%84%E0%B8%B4%E0%B8%94%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%84%E0%B8%99%E0%B8%A3%E0%B8%A7%E0%B8%A2-93378bbb4efb?source=rss-cb719d45560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/93378bbb4efb</guid>
            <category><![CDATA[inspire-new]]></category>
            <category><![CDATA[rich-people-things]]></category>
            <category><![CDATA[inspiration]]></category>
            <dc:creator><![CDATA[Manit Cholpinyo]]></dc:creator>
            <pubDate>Sun, 15 Oct 2017 06:59:07 GMT</pubDate>
            <atom:updated>2017-11-19T05:20:03.598Z</atom:updated>
            <content:encoded><![CDATA[<p>เราทำได้</p><p>วันที่ 18 ก.ค. 60</p><p>วันนี้เป็นวันที่เปลี่ยนชีวิตของเรา จากการได้อ่าน หนังสือพ่อรวยสอนลูก มันต่างจากหนังสือที่อ่านมาทั้งหมด ซึ่ง มันเอาสิ่งที่เราอ่านทั้งหมดเกี่ยวกับความสำเร็จทางอาชีพทางความคิดแนวคิด ประติดประต่อกัน และเมื่อเราเข้าใจทุกอย่างของชีวิต สุดท้าย การวางแผนทางการเงินมันคือบทสรุป</p><p>สิ่งที่ทำให้เราอ่านแล้วสะดุ้งขึ้นมาเลยก็คือ มันตัดทุกอย่างที่เราอยากได้ขึ้นมาทันทีทั้งกล้องถ่ายภาพ รองเท้า รถยนต์ ซึ่งตอนแรก เราคิดว่าหลังจากทำงานเสร็จจะหาซื้อมาแต่จริงๆแล้ว เราคิดผิด หนังสือเล่มนี้มันสอนให้เรารอ การวางแผนที่มีคุณค่ามากที่สุด</p><blockquote>คนรวยสร้างทรัพย์สินเป็นอันดับแรก จนกระทั่งทรัพย์สินของพวกเขาสร้างกระแสเงินสดที่มากพอ พวกเขาจึงซื้อหาความสะดวกสบายเข้าตัวแบบไม่ต้องเหนื่อย</blockquote><blockquote>จงเริ่มต้นคิดถึงการมีธุรกิจของตัวเอง ทำงานประจำของคุณให้ดี และแบ่งเวลาสร้างทรัพย์สินให้กับตัวเอง ไม่ใช่สร้างหนี้สิน</blockquote><p>เราอ่านจบแค่ 3 บทแล้ว เข้าใจเลย การสอนของพ่อรวย</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93378bbb4efb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[นิทาน: ม้ากับลา # 1]]></title>
            <link>https://mcnewz.medium.com/%E0%B8%99%E0%B8%B4%E0%B8%97%E0%B8%B2%E0%B8%99-%E0%B8%A1%E0%B9%89%E0%B8%B2%E0%B8%81%E0%B8%B1%E0%B8%9A%E0%B8%A5%E0%B8%B2-1-f0f3d596de36?source=rss-cb719d45560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0f3d596de36</guid>
            <category><![CDATA[inspiration]]></category>
            <category><![CDATA[inspire-new]]></category>
            <dc:creator><![CDATA[Manit Cholpinyo]]></dc:creator>
            <pubDate>Thu, 12 Oct 2017 16:53:15 GMT</pubDate>
            <atom:updated>2017-11-19T05:19:38.019Z</atom:updated>
            <content:encoded><![CDATA[<p>ลาและม้า</p><p><strong>โรงสีแห่งหนึ่งในอำเภอเฉิงซี แห่งนครฉางอัน</strong></p><p>มีม้าและลาตัวหนึ่งอาศัยอยู่ พวกมันเป็นเพื่อนสนิทกัน ม้ามีหน้าที่ลากรถอยู่ข้างนอก ส่วนลาก็ทำงานอยู่ในโรงสี</p><p>ในปีที่ 3 ของยุคเจินกวาน ม้าตัวนี้ถูกพระเสวียนจ้าง หรือที่รู้จักกันในนิยายเรื่องไซอิ๋ว ว่าพระถังซำจั๋ง เลือกให้ออกเดินทางไปยังตะวันตกมุ่งสู่ประเทศอินเดียเพื่อจาริกแสวงบุญ</p><p>17 ปีต่อมา ม้าตัวนี้อัญเชิญคัมภีร์พุทธศาสนากลับมายังนครฉางอัน เมื่อกลับมายังโรงสี หาเพื่อนของมัน มันได้เล่าถึงประสบการณ์ที่ได้รับจากการเดินท่องเที่ยว รวมทั้งดินแดนที่เหมือนกับที่ถูกเล่าขานกันในตำนานเหล่านั้นให้ลาฟัง</p><p>พอเจ้าลาฟังแล้วรู้สึกประหลาดใจเป็นอย่างมาก</p><p>อดไม่ได้ที่จะอุทานวา “เจ้ามีประสบการณ์มากมายอะไรเช่นนี้! หนทางที่ยาวไกลเช่นนั้น แค่คิดข้ายังไม่กล้าเลย”</p><p>ม้าแก่กล่าวว่า</p><blockquote>อันที่จริง ระยะทางที่พวกเราก้าวเดินก็พอๆ กัน ตอนที่ข้ามุ่งหน้าไปทางตะวันตก เจ้าก็เดินไม่หยุดเช่นกัน แต่สิ่งที่แตกต่างกันระหว่างเราก็คือ ข้าและพระเสวียนจ้างมีเป้าหมายที่ยาวไกล</blockquote><blockquote>และมุ่งไปข้างหน้าตลอด พวกเราจึงมีโอกาสเปิดตัวเองสู่โลกกว้างแต่เจ้ากลับถูกปิดหูปิดตา และใช้ชีวิตอยู่รอบๆ โรงสี ด้วยเหตุนี้ เจ้าจึงไม่มีวันเดินออกมาจากโลกแคบๆ ได้</blockquote><h3>สรุป</h3><p>นิทานเรื่องนี้สอนให้รู้ว่า คนที่ไม่มีทิศทางที่ถูกต้อง ในชีวิตก็จะทุกข์ทรมานอยู่ในโลกแคบๆ ใบนี้ตลอดไป แม้ความคนคนนั้นจะพยายาม อย่างเต็มที่ก็ตาม แต่ถ้าความพยายามนั้นเป็นไปในทิศทางที่ไม่ถูกต้องแล้ว ทุกอย่างก็ไร้ความหมาย</p><p>เช่นเดียวกับ เป้าหมายในชีวิตของทุกคน มันไม่สำคัญหรอก ว่าเราจะมาจากไหน จะจบอะไรมา จะเป็นลูกเต้าเหล่าใคร ทุกๆ คนล้วนมีจุดเด่น มีความแตกต่าง ที่อธิบายความเป็นตัวเรา … มันอยู่ที่ว่า จุดหมายที่เราจะไปถึงต่างหากสำคัญที่สุด เรามีเป้าหมาย เรามีเส้นทางไป</p><p>ทุกคนที่ท้อ ที่กำลังหมดหวัง โปรดอย่าคิดว่าตัวเองไม่มีความหมายอะไร จงถามตัวเอง จริงๆแล้ว เราชอบอะไร แล้วทำมันซะ โดยไม่ต้องตั้งคำถามว่า ทำไม ทำไม … เช่นเดียวกับ การเอานิ้วจิ้มเกลือแล้วเลียไปที่นิ้วที่จิ้มเกลือนั้น จะรู้ว่ามันเค็ม เราไม่จำเป็นต้องสงสัยว่าเค็มคืออะไร … เค็มมันก็คือเค็มนั่นเหละ นี่คือการลงมือทำ โดยตั้งปฏิภาณในใจ ว่าเราชอบ …และอย่าสงสัยความชอบที่ตัวเองมี เพราะว่า … ชอบมันก็คือชอบนั่นเหละ ^_^</p><p>#จากหนังสือ คุณในอนาคต ต้องขอบคุณตัวเอง ที่อดทนสู้ในวันนี้</p><p>#mcnewz</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0f3d596de36" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>