Do you get big delays with the motor system?
This is just an assumption, but the DroidLED constructor calls for expensive system initializations. Could you do this?
public class MyWidgetClickHandler { private DroidLED = null; public MyWidgetClickHandler(string ManuName) {
There could be a lot more. For example, you can create an LED
interface
with enable
and isEnabled
and have two implementations for it. One of them will be DroidLED
, and the other is CommonCameraLED
. In this case, it looks like this:
public class LEDFactory { public static LED createLED(string ManuName) { if (ManuName != null && ManuName.toLowerCase().contains("motorola")) return new DroidLED(); else return new CommonCameraLED(); } } public class MyWidgetClickHandler { private LED myLed = null; public MyWidgetClickHandler(string ManuName) { myLed = LEDFactory.createLED(ManuName); } public void processOnClick() { myLed.enable(true);
You can also create Thread to initialize so that the phone does not start slowly.
source share