2011年4月18日 星期一

工作日誌很重要

無論如何,把WeeklyReport當工作日誌寫,絕對是有幫助的
不管有沒有人看,用自己的思路,整理自己的工作,用最省時的方式記錄下來
隨時都可以更新
我只要看到Weekly Report是每周更新一次的,就知道只是應付上面要求,那真的寫了對自己是浪費時間
隨時更新才能隨時做計畫,檢討並調整方向
一定會有幫助
But it still depend on you
I have no right to force you
It's just for your own good

2011年4月15日 星期五

Important Notes for Android Bound Service



There are three ways you can define the interface:
Extending the Binder class
If your service is private to your own application and runs in the same process as the client (which is common), you should create your interface by extending the Binderclass and returning an instance of it from onBind(). The client receives the Binderand can use it to directly access public methods available in either the Binderimplementation or even the Service.
This is the preferred technique when your service is merely a background worker for your own application. The only reason you would not create your interface this way is because your service is used by other applications or across separate processes.
Using a Messenger
If you need your interface to work across different processes, you can create an interface for the service with a Messenger. In this manner, the service defines a Handler that responds to different types of Message objects. This Handler is the basis for a Messenger that can then share an IBinder with the client, allowing the client to send commands to the service using Message objects. Additionally, the client can define aMessenger of its own so the service can send messages back.
This is the simplest way to perform interprocess communication (IPC), because the Messenger queues all requests into a single thread so that you don't have to design your service to be thread-safe.
Using AIDL
AIDL (Android Interface Definition Language) performs all the work to decompose objects into primitives that the operating system can understand and marshall them across processes to perform IPC. The previous technique, using a Messenger, is actually based on AIDL as its underlying structure. As mentioned above, the Messenger creates a queue of all the client requests in a single thread, so the service receives requests one at a time. If, however, you want your service to handle multiple requests simultaneously, then you can use AIDL directly. In this case, your service must be capable of multi-threading and be built thread-safe.
To use AIDL directly, you must create an .aidl file that defines the programming interface. The Android SDK tools use this file to generate an abstract class that implements the interface and handles IPC, which you can then extend within your service.
Note: Most applications should not use AIDL to create a bound service, because it may require multithreading capabilities and can result in a more complicated implementation. As such, AIDL is not suitable for most applications and this document does not discuss how to use it for your service. If you're certain that you need to use AIDL directly, see the AIDL document.

2011年4月14日 星期四

Scrollable TabWidget in Android

I practiced the Tab Layout Tutorial by

http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

and realized that I need to scroll the TabWidget. After Goofling "android scroll tabwidget",
thanks to bscarl88

http://androidforums.com/application-development/118108-scrollable-tabs.html

I could not successfully paste the xml here, so I use "[" and "]" instead of "<" and ">"
 

Originally is


                    [TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" /]


Now is


[HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"]    
                    [TabWidget
        android:orientation="horizontal"
           android:id="@android:id/tabs"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content" /]
        [/HorizontalScrollView]  

2011年4月6日 星期三

上帝的安排真是奇妙, What's Next?

本以為我換了三個全然不相干的產業和職能, 但現在回頭檢視, 竟是環環相扣


中光電: 背光板色彩, 光學檢測程式(VB)
宇太新: ERP 物管系統(VB), EAI(Java, Software Engineering)
崴強:     DSC 影像色彩, MFP DSP/影像色彩, Qt/QML, RTOS(C)/Linux(C)/Android(Java)


在崴強用到了前兩個工作的技術觀念, 下一個工作會發生什麼事呢?