I use android.widget.Switch.
Logs
--------- beginning of /dev/log/system
I/ActivityManager( 301): Process edu.mit.appinventor.aicompanion3 (pid 23161) has died.
W/InputDispatcher( 301): channel '41d25f40 edu.mit.appinventor.aicompanion3/edu.mit.appinventor.aicompanion3.Screen1 (server)' ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher( 301): channel '41d25f40 edu.mit.appinventor.aicompanion3/edu.mit.appinventor.aicompanion3.Screen1 (server)' ~ Channel is unrecoverably broken and will be disposed!
W/InputDispatcher( 301): Attempted to unregister already unregistered input channel '41d25f40 edu.mit.appinventor.aicompanion3/edu.mit.appinventor.aicompanion3.Screen1 (server)'
I/WindowManager( 301): WINDOW DIED Window{41d25f40 edu.mit.appinventor.aicompanion3/edu.mit.appinventor.aicompanion3.Screen1 paused=false}
W/WindowManager( 301): Failed looking up window
W/WindowManager( 301): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@423b68b8 does not exist
W/WindowManager( 301): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7753)
W/WindowManager( 301): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7744)
W/WindowManager( 301): at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:854)
W/WindowManager( 301): at android.os.BinderProxy.sendDeathNotice(Binder.java:449)
W/WindowManager( 301): at dalvik.system.NativeStart.run(Native Method)
I/WindowState( 301): WIN DEATH: null
W/InputMethodManagerService( 301): Got RemoteException sending setActive(false) notification to pid 23161 uid 10072
I/ActivityManager( 301): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 pkg=edu.mit.appinventor.aicompanion3 cmp=edu.mit.appinventor.aicompanion3/.Screen1 bnds=[16,970][112,1066] u=0} from pid 513
D/ActivityThread( 513): handlePauseActivity set pri:-16
I/dalvikvm(23412): Turning on JNI app bug workarounds for target SDK version 4...
E/ActivityManager( 301): starting process edu.mit.appinventor.aicompanion3
I/ActivityManager( 301): Start proc edu.mit.appinventor.aicompanion3 for activity edu.mit.appinventor.aicompanion3/.Screen1: pid=23412 uid=10072 gids={1028, 1015, 1006, 3002, 3003, 3001}
E/NvCpuService( 116): unable to open /d/tegra_hotplug/core_bias
E/Trace (23412): error opening trace file: No such file or directory (2)
I/MultiDex(23412): VM with version 1.6.0 does not have multidex support
I/MultiDex(23412): install: doIt = false
E/WindowManager( 301): createScaleUpAnimationLocked transit:8204 duration:500
E/WindowManager( 301): createScaleUpAnimationLocked transit:8204 duration:500
D/MultiDex(23412): Proceeding with installation...
I/MultiDex(23412): MultiDexExtractor.load(/data/app/edu.mit.appinventor.aicompanion3-1.apk, false)
I/MultiDex(23412): loading existing secondary dex files
I/MultiDex(23412): load found 1 secondary dex files
I/MultiDex(23412): install done
I/ReplApplication(23412): ACRA Not Active
D/Form (23412): Form Screen1 got onCreate
I/Form (23412): activeForm is now Screen1
D/Form (23412): deviceDensity = 1.0
I/Form (23412): compatScalingFactor = 2.5
D/Form (23412): MULTI: _initialized = false formName = Screen1
D/Form (23412): MultiDex already installed.
D/Form (23412): onCreateFinish called 1507473234298
D/Form (23412): recomputeLayout called
D/Form (23412): About to create a new ScaledFrameLayout
D/Form (23412): Sizing(Fixed)
D/Form (23412): formWidth = 320 formHeight = 492
D/MediaUtil(23412): mediaPath = mooning.png
D/MediaUtil(23412): getBitmapOptions: sampleSize = 1 mediaPath = mooning.png maxWidth = 720 maxHeight = 840 display width = 800 display height = 1232
D/Form (23412): recomputeLayout called
D/Form (23412): About to create a new ScaledFrameLayout
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/Form (23412): Form.Width = 320
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/Form (23412): Form.Width = 320
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
D/Form (23412): Form.Width = 320
W/System.err(23412): Form.setChildWidth(): width = -2 parent Width = 320 child = com.google.appinventor.components.runtime.VerticalArrangement@41f4f4c0
D/Form (23412): Form.Width = 320
W/System.err(23412): Form.setChildWidth(): width = -2 parent Width = 320 child = com.google.appinventor.components.runtime.VerticalArrangement@41f72110
D/Form (23412): Form.Width = 320
D/MediaUtil(23412): mediaPath = Title.png
D/MediaUtil(23412): getBitmapOptions: sampleSize = 1 mediaPath = Title.png maxWidth = 720 maxHeight = 840 display width = 800 display height = 1232
D/Form (23412): Form.Width = 320
D/Form (23412): Form.Width = 320
D/Form (23412): Form.Width = 320
V/TrashClearDatabaseHelper( 9713): TrashClearDatabaseHelper,openDatabase,begin
D/Form (23412): Form.Height = 492
D/dalvikvm(23412): GC_CONCURRENT freed 2026K, 21% free 8062K/10183K, paused 6ms+5ms, total 61ms
D/dalvikvm(23412): WAIT_FOR_CONCURRENT_GC blocked 43ms
D/Form (23412): Form.Width = 320
D/Form (23412): Form.Width = 320
D/MediaUtil(23412): mediaPath = Instructions.png
D/MediaUtil(23412): getBitmapOptions: sampleSize = 1 mediaPath = Instructions.png maxWidth = 720 maxHeight = 840 display width = 800 display height = 1232
D/Form (23412): Form.Width = 320
D/Form (23412): Form.Height = 492
D/Form (23412): Form.Width = 320
D/Form (23412): Form.Width = 320
D/Form (23412): Form.Width = 320
D/Form (23412): Form.Width = 320
D/Form (23412): Form.Height = 492
D/MediaUtil(23412): mediaPath = connectwCode.png
D/MediaUtil(23412): getBitmapOptions: sampleSize = 1 mediaPath = connectwCode.png maxWidth = 720 maxHeight = 840 display width = 800 display height = 1232
D/Form (23412): Form.Height = 492
D/MediaUtil(23412): mediaPath = connectwQR.png
D/MediaUtil(23412): getBitmapOptions: sampleSize = 1 mediaPath = connectwQR.png maxWidth = 720 maxHeight = 840 display width = 800 display height = 1232
D/Form (23412): Form.Width = 320
D/Form (23412): Form.Width = 320
D/ReplForm(23412): onCreate
D/ActivityThread(23412): handleResumeActivity now pri:0
D/ActivityThread(23412): handleResumeActivity set pri:-16
I/Form (23412): Form Screen1 got onResume
D/SizeAdaptiveLayout( 419): com.android.internal.widget.SizeAdaptiveLayout@42469448child view android.widget.LinearLayout@41dc2830 measured out of bounds at 56px clamped to 64px
D/SizeAdaptiveLayout( 419): com.android.internal.widget.SizeAdaptiveLayout@42469448child view android.widget.LinearLayout@41dc2830 measured out of bounds at 56px clamped to 64px
V/TabletStatusBar( 419): setLightsOn(true)
D/Form (23412): onGlobalLayout(): heightdiff = 25 contentViewTop = 25
D/Form (23412): keyboard hidden!
D/Form (23412): Sizing(Fixed)
D/Form (23412): formWidth = 320 formHeight = 492
D/Form (23412): ReplayFormOrientation()
D/Form (23412): Sizing(Fixed)
D/Form (23412): formWidth = 320 formHeight = 492
D/Form (23412): ReplayFormOrientation()
D/PhoneStatus(23412): android.os.Build.VERSION.RELEASE = 4.1.1
D/PhoneStatus(23412): android.os.Build.PRODUCT = mx532
D/Form (23412): Sizing(Fixed)
D/Form (23412): formWidth = 320 formHeight = 492
D/ReplForm(23412): HandleReturnValues() Called, replResult = null
D/Form (23412): onGlobalLayout(): heightdiff = 25 contentViewTop = 25
D/Form (23412): keyboard hidden!
I/TrashClearDatabaseHelper( 9713): openDatabase: mDataVersion = 5
V/TrashClearDatabaseHelper( 9713): TrashClearDatabaseHelper,openDatabase,end
D/TrashClearDatabaseHelper( 9713): getAppType pkg=edu.mit.appinventor.aicompanion3 type=-1
I/ActivityManager( 301): Displayed edu.mit.appinventor.aicompanion3/.Screen1: +995ms
D/Form (23412): onGlobalLayout(): heightdiff = 25 contentViewTop = 25
D/Form (23412): keyboard hidden!
D/WifiService( 301): ACTION_BATTERY_CHANGED pluggedType: 1
V/ActivityThread( 2691): Performing receive of Intent { flg=0x14 cmp=com.liquidum.thecleaner/.receiver.StartServiceAlarmReceiver (has extras) } receiver.getPendingResult():ReceiverData{intent=Intent { flg=0x14 cmp=com.liquidum.thecleaner/.receiver.StartServiceAlarmReceiver (has extras) } packageName=com.liquidum.thecleaner resultCode=0 resultData=null resultExtras=null}
D/WifiService( 301): ACTION_BATTERY_CHANGED pluggedType: 1
I/Sensors ( 301): **** No Motion ****
I/Sensors ( 301): **** Motion ****
D/PhoneStatus(23412): Seed = szoojn
D/PhoneStatus(23412): Code = e6c8a64d977caa8b9dcd61d24a3de3dea71f5e87
I/ReplForm(23412): started AppInvHTTPD
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 0
D/AppInvHTTPD(23412): OPTIONS '/'
D/AppInvHTTPD(23412): HDR: 'connection' = 'keep-alive'
D/AppInvHTTPD(23412): HDR: 'host' = '
192.168.1.41:8001'
D/AppInvHTTPD(23412): HDR: 'accept-language' = 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3'
D/AppInvHTTPD(23412): HDR: 'accept' = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
D/AppInvHTTPD(23412): HDR: 'access-control-request-method' = 'PUT'
D/AppInvHTTPD(23412): HDR: 'origin' = '
http://ai2.appinventor.mit.edu'
D/AppInvHTTPD(23412): HDR: 'user-agent' = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0'
D/AppInvHTTPD(23412): HDR: 'accept-encoding' = 'gzip, deflate'
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 1
D/AppInvHTTPD(23412): PUT '/'
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 2
D/AppInvHTTPD(23412): OPTIONS '/'
D/AppInvHTTPD(23412): HDR: 'connection' = 'keep-alive'
D/AppInvHTTPD(23412): HDR: 'host' = '
192.168.1.41:8001'
D/AppInvHTTPD(23412): HDR: 'accept-language' = 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3'
D/AppInvHTTPD(23412): HDR: 'accept' = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
D/AppInvHTTPD(23412): HDR: 'access-control-request-method' = 'PUT'
D/AppInvHTTPD(23412): HDR: 'origin' = '
http://ai2.appinventor.mit.edu'
D/AppInvHTTPD(23412): HDR: 'user-agent' = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0'
D/AppInvHTTPD(23412): HDR: 'accept-encoding' = 'gzip, deflate'
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 2
D/AppInvHTTPD(23412): PUT '/'
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 2
D/AppInvHTTPD(23412): POST '/_extensions'
D/ReplForm(23412): Loading component dex /storage/sdcard0/AppInventor/assets/external_comps/vlad/vlad.jar
D/ReplForm(23412): Loading component dex /storage/sdcard0/AppInventor/assets/external_comps/showmethods/showmethods.jar
D/ReplForm(23412): Thread[HTTPD Session,5,biggerstack]
D/ReplForm(23412): Thread[main,5,main]
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 2
D/AppInvHTTPD(23412): GET '/_getversion'
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 2
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 2
D/AppInvHTTPD(23412): POST '/_newblocks'
D/AppInvHTTPD(23412): Incoming Mac = 498bc35ef7e7aa021153ebee8c0cdc4b01bf18fc
D/AppInvHTTPD(23412): Computed Mac = 498bc35ef7e7aa021153ebee8c0cdc4b01bf18fc
D/AppInvHTTPD(23412): Incoming seq = 1
D/AppInvHTTPD(23412): Computed seq = 1
D/AppInvHTTPD(23412): blockid = -2
D/AppInvHTTPD(23412): To Eval: (begin (require <com.google.youngandroid.runtime>) (process-repl-input -2 (begin (clear-current-form)(try-catch (let ((attempt (delay (set-form-name "Screen1")))) (force attempt)) (exception java.lang.Throwable 'notfound))(do-after-form-creation (set-and-coerce-property! 'Screen1 'AppName "StudyExtension" 'text)\u000a (set-and-coerce-property! 'Screen1 'BackgroundColor #x00FFFFFF 'number)\u000a (set-and-coerce-property! 'Screen1 'Title "Screen1" 'text)\u000a)\u000a\u000a(add-component Screen1 com.google.appinventor.components.runtime.Button Button1 \u000a(set-and-coerce-property! 'Button1 'Text "Text for Button1" 'text)\u000a\u000a)\u000a\u000a(add-component Screen1 com.google.appinventor.components.runtime.VerticalArrangement VerticalArrangement1 \u000a(set-and-coerce-property! 'VerticalArrangement1 'BackgroundColor #xFF888888 'number)\u000a\u000a)\u000a\u000a(add-component Screen1 com.google.appinventor.components.runtime.Button Button2 \u000a(set-and-coerce-property! 'Button2 'Text "Text for Button2" 'text)\u000a\u000a)\u000a\u000a(add-component Screen1 showmethods.ShowMethodList ShowMethodList1 \u000a)\u000a(init-runtime)(call-Initialize-of-components 'Screen1 'Button1 'VerticalArrangement1 'Button2 'ShowMethodList1) )))
D/AppInvHTTPD(23412): POST '/_values'
D/dalvikvm(23412): GC_CONCURRENT freed 2813K, 24% free 9386K/12295K, paused 22ms+3ms, total 57ms
D/dalvikvm(23412): WAIT_FOR_CONCURRENT_GC blocked 17ms
D/WifiService( 301): ACTION_BATTERY_CHANGED pluggedType: 1
D/Form (23412): recomputeLayout called
D/Form (23412): About to create a new ScaledFrameLayout
D/Form (23412): Sizing(Fixed)
D/Form (23412): formWidth = 320 formHeight = 492
W/System.err(23412): Form.clear() About to do moby GC!
D/dalvikvm(23412): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm(23412): GC_EXPLICIT freed 1891K, 29% free 8731K/12295K, paused 2ms+3ms, total 43ms
D/ReplForm(23412): formName is now Screen1
D/HVArrangement(23412): Setting up frameContainer = FrameLayout()
I/Form (23412): calling Initialize method for Object edu.mit.appinventor.aicompanion3.Screen1@41cb96f0
D/Form (23412): onGlobalLayout(): heightdiff = 25 contentViewTop = 25
D/Form (23412): keyboard hidden!
D/Form (23412): onGlobalLayout(): heightdiff = 25 contentViewTop = 25
D/Form (23412): keyboard hidden!
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 2
D/AppInvHTTPD(23412): POST '/_values'
D/Form (23412): Sizing(Fixed)
D/Form (23412): formWidth = 320 formHeight = 492
D/Form (23412): ReplayFormOrientation()
D/Form (23412): Sizing(Fixed)
D/Form (23412): formWidth = 320 formHeight = 492
D/ReplForm(23412): HandleReturnValues() Called, replResult = null
D/Form (23412): onGlobalLayout(): heightdiff = 25 contentViewTop = 25
D/Form (23412): keyboard hidden!
D/Form (23412): onGlobalLayout(): heightdiff = 25 contentViewTop = 25
D/Form (23412): keyboard hidden!
I/Sensors ( 301): **** No Motion ****
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 2
D/AppInvHTTPD(23412): POST '/_newblocks'
D/AppInvHTTPD(23412): Incoming Mac = ffd159b13e819c1483f0953fb5dabf3a9b0f036b
D/AppInvHTTPD(23412): Computed Mac = ffd159b13e819c1483f0953fb5dabf3a9b0f036b
D/AppInvHTTPD(23412): Incoming seq = 2
D/AppInvHTTPD(23412): Computed seq = 2
D/AppInvHTTPD(23412): blockid = "cte0xAAW{fMV]0pVp*p("
D/AppInvHTTPD(23412): To Eval: (begin (require <com.google.youngandroid.runtime>) (process-repl-input "cte0xAAW{fMV]0pVp*p(" (begin (call-component-method 'ShowMethodList1 'Create1 (*list-for-runtime* "Button" "Button") '(text text)) )))
D/AndroidRuntime(23412): Shutting down VM
W/dalvikvm(23412): threadid=1: thread exiting with uncaught exception (group=0x4167e318)
E/AndroidRuntime(23412): FATAL EXCEPTION: main
E/AndroidRuntime(23412): java.lang.NullPointerException
E/AndroidRuntime(23412): at android.text.Layout.getDesiredWidth(Layout.java:67)
E/AndroidRuntime(23412): at android.widget.Switch.makeLayout(Switch.java:545)
E/AndroidRuntime(23412): at android.widget.Switch.onMeasure(Switch.java:479)
E/AndroidRuntime(23412): at android.view.View.measure(View.java:15172)
E/AndroidRuntime(23412): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814)
E/AndroidRuntime(23412): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
E/AndroidRuntime(23412): at android.view.View.measure(View.java:15172)
E/AndroidRuntime(23412): at android.widget.LinearLayout.measureVertical(LinearLayout.java:833)
E/AndroidRuntime(23412): at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
E/AndroidRuntime(23412): at android.view.View.measure(View.java:15172)
E/AndroidRuntime(23412): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814)
E/AndroidRuntime(23412): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
E/AndroidRuntime(23412): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2150)
E/AndroidRuntime(23412): at android.view.View.measure(View.java:15172)
E/AndroidRuntime(23412): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1848)
E/AndroidRuntime(23412): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1100)
E/AndroidRuntime(23412): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1273)
E/AndroidRuntime(23412): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
E/AndroidRuntime(23412): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4239)
E/AndroidRuntime(23412): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
E/AndroidRuntime(23412): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
E/AndroidRuntime(23412): at android.view.Choreographer.doFrame(Choreographer.java:525)
E/AndroidRuntime(23412): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
E/AndroidRuntime(23412): at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime(23412): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(23412): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(23412): at android.app.ActivityThread.main(ActivityThread.java:4762)
E/AndroidRuntime(23412): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(23412): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(23412): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
E/AndroidRuntime(23412): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
E/AndroidRuntime(23412): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 301): Force finishing activity edu.mit.appinventor.aicompanion3/.Screen1
W/ActivityManager( 301): Activity pause timeout for ActivityRecord{41dacb20 edu.mit.appinventor.aicompanion3/.Screen1}
E/NvCpuService( 116): unable to open /d/tegra_hotplug/core_bias
D/ActivityThread( 513): handleResumeActivity now pri:-16
D/ActivityThread( 513): handleResumeActivity set pri:-16
E/WindowManager( 301): transit:WindowAnimation_wallpaperOpenEnterAnimation
E/WindowManager( 301): transit:WindowAnimation_wallpaperOpenExitAnimation
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 2
D/AppInvHTTPD(23412): POST '/_values'
D/AppInvHTTPD(23412): NanoHTTPD: getPoolSize() = 2
I/ActivityManager( 301): No longer want com.android.email (pid 21742): hidden #16