Android Threads, Handlers and AsyncTask

先看過Processes and Threads會有比較清楚的概念, 當Adnroid Application 啟動後, 系統會建一個主要的thread 稱 “main thread” or “UI thread”, 所有的components 皆跑在這個UI thread, system calls 也是透過UI thread dispatched給各個component, ex: onKeyDown, touch event. UI thread 如因大量運算或等待而blocked, 預設超過5秒ANR(Application Not Responding)就會發生. 且Android UI components 並非thread-safe, 使用上要特別小心. 所以: long time computation使用另外的thread, 不要寫在 UI Thread. 不要在UI thread 之外使用UI component method. 透過Thread, Handler and AsyncTask perform asynchronous processing, 避免UI thread block. Threads Android 提供以下的method, 可在其它的thread 下調用 UI thread. Activity.runOnUiThread(Runnable) View.post(Runnable) <-- used in example code. View.postDelayed(Runnable, long) 或是使用Handler or AsyncTasks class 達到同樣的效果. ...

June 14, 2012 · 1 min · oopsmonk

COMPUTEX TAIPEI 2012

這次的Computex show 中Micorsofte主要是強打windows 8系統的 Ultrabook, Tablet , AIO(All in One) PC, 主要大廠ASUS, Acer, Compal, Gigabyte, MSI, Samsung …等都有展出, 除了這些來看看其它有趣的東西吧. 互動感十足的販賣機, 原本以為是單純的transparent panel 播放動畫, 沒想到是touch panel還可以玩game, AUO的面板, 當然這麼大的面板用的是光學觸控(Optical touch). LITEMAX(晶達光電) 的 Spanpixel Resizing LCD透過獨特的面板切割技術, 提供非一般標準比例的LCD顯示器. 做為特殊工業應用, 車站、購物中心,公共資訊…等的顯示應用. 今年掛牌上市的公司, 電子廣告看板模組似乎有不錯的潛力. 讓我想到Always Innovatin 的 HDMI Dongle, 家裡的舊電視只要有HDMI port就可以升級成SmartTV, 後來得知國內有几家公司有在做類似的產品, 似乎也是不錯的商機. Genius 在2011年推出全球首款Ring Mouse, 今年又推出新一代的Ring Presenter. 用的是2.4GHz無線. 精傑電子, 主要強調3D graphic處理能力, 應用在3D presentations, 用transparent panel. 總覺得與磐儀科技推的行動醫療平板很像. 規格如下: CPU: AMD G-Series T56N Dual Core GPU: AMD Radeon HD6320 Screen: 10.4" XGA color LCD(1024x768), touch panel Memory: 4GB DDR3 memory Storage: 32GB SSD Drive Wireless: 802.11 b/g/n, Bluetooth interfaces LAN: Gigabit Ethernet Camera: auto-focus CMOS 5.0 megapixels Battery life: 2.5_3 hours (2 batteries) Weight: 1.75kg (with 2 batteries) 手上拿的是Google Glass ?! 記得CES show中的demo有看過這眼鏡, 暫時找不到之前youtbe上的影片.." ...

June 10, 2012 · 1 min · oopsmonk