Last active
August 29, 2015 14:05
-
-
Save booknara/7ab408b87a253dcb026d to your computer and use it in GitHub Desktop.
How to detect whether the device is a tablet or phone in Android programmatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 09-04 13:38:20.219 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Start session with context: com.zerodesktop.appdetox.dinnertime.control.ui.application.AppsActivity@64e590a8 count:0 | |
| 09-04 13:38:22.772 16987-23315/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ FlurryDataSender: report 94b1317f-ef93-48c1-b874-9cf6488d5183 sent. HTTP response: 200 | |
| 09-04 13:38:29.960 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Start session with context: com.zerodesktop.appdetox.dinnertime.control.ui.device.MainActivity@64fc12a0 count:1 | |
| 09-04 13:38:30.941 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ End session with context: com.zerodesktop.appdetox.dinnertime.control.ui.application.AppsActivity@64e590a8 count:1 | |
| 09-04 13:38:37.328 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Event count started: /apps | |
| 09-04 13:38:37.398 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Start session with context: com.zerodesktop.appdetox.dinnertime.control.ui.application.AppsActivity@656b9078 count:1 | |
| 09-04 13:38:37.958 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ End session with context: com.zerodesktop.appdetox.dinnertime.control.ui.device.MainActivity@64fc12a0 count:1 | |
| 09-04 13:38:39.830 16987-17002/com.zerodesktop.appdetox.dinnertimeplus I/art﹕ GcCauseBackground sticky partial concurrent mark sweep GC freed 43209(2MB) AllocSpace objects, 21(549KB) LOS objects, 12% free, 20MB/23MB, paused 11.323ms total 134.564ms | |
| 09-04 13:38:40.211 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Start session with context: com.zerodesktop.appdetox.dinnertime.control.ui.device.MainActivity@64fc12a0 count:1 | |
| 09-04 13:38:40.981 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ End session with context: com.zerodesktop.appdetox.dinnertime.control.ui.application.AppsActivity@656b9078 count:1 | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ org.json.JSONException: Value WITH_RESTRICTION of type java.lang.String cannot be converted to JSONObject | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at org.json.JSON.typeMismatch(JSON.java:111) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at org.json.JSONObject.<init>(JSONObject.java:159) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at org.json.JSONObject.<init>(JSONObject.java:172) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.common.b.g.a(Unknown Source) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.logic.database.objectmodel.LHDeviceNotification.getDeviceNotification(Unknown Source) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.ui.a.d.a(Unknown Source) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.ui.misc.DeviceNotificationAlertActivity.onCreate(Unknown Source) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5231) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.access$800(ActivityThread.java:135) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:102) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.os.Looper.loop(Looper.java:136) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5001) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at java.lang.reflect.Method.invoke(Native Method) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) | |
| 09-04 13:39:12.785 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ org.json.JSONException: Value WITH_RESTRICTION of type java.lang.String cannot be converted to JSONObject | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at org.json.JSON.typeMismatch(JSON.java:111) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at org.json.JSONObject.<init>(JSONObject.java:159) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at org.json.JSONObject.<init>(JSONObject.java:172) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.common.b.g.a(Unknown Source) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.logic.database.objectmodel.LHDeviceNotification.getDeviceNotification(Unknown Source) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.ui.a.d.b(Unknown Source) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.ui.misc.DeviceNotificationAlertActivity.onCreate(Unknown Source) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5231) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.access$800(ActivityThread.java:135) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:102) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.os.Looper.loop(Looper.java:136) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5001) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at java.lang.reflect.Method.invoke(Native Method) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ org.json.JSONException: Value WITH_RESTRICTION of type java.lang.String cannot be converted to JSONObject | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at org.json.JSON.typeMismatch(JSON.java:111) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at org.json.JSONObject.<init>(JSONObject.java:159) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at org.json.JSONObject.<init>(JSONObject.java:172) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.common.b.g.a(Unknown Source) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.logic.database.objectmodel.LHDeviceNotification.getDeviceNotification(Unknown Source) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.ui.a.d.a(Unknown Source) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.ui.misc.DeviceNotificationAlertActivity.onCreate(Unknown Source) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5231) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.access$800(ActivityThread.java:135) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:102) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.os.Looper.loop(Looper.java:136) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5001) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at java.lang.reflect.Method.invoke(Native Method) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus D/AndroidRuntime﹕ Shutting down VM | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ java.lang.RuntimeException: Unable to start activity ComponentInfo{com.zerodesktop.appdetox.dinnertimeplus/com.zerodesktop.appdetox.dinnertime.control.ui.misc.DeviceNotificationAlertActivity}: java.lang.NullPointerException: Attempt to read from field 'long com.zerodesktop.appdetox.dinnertime.common.b.g.f' on a null object reference | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.access$800(ActivityThread.java:135) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:102) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.os.Looper.loop(Looper.java:136) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5001) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at java.lang.reflect.Method.invoke(Native Method) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ Caused by: java.lang.NullPointerException: Attempt to read from field 'long com.zerodesktop.appdetox.dinnertime.common.b.g.f' on a null object reference | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.ui.a.d.a(Unknown Source) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at com.zerodesktop.appdetox.dinnertime.control.ui.misc.DeviceNotificationAlertActivity.onCreate(Unknown Source) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5231) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/System.err﹕ ... 9 more | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Error logged: uncaught | |
| 09-04 13:39:12.795 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ End session with context: com.zerodesktop.appdetox.dinnertime.control.ui.device.MainActivity@64fc12a0 count:0 | |
| 09-04 13:39:12.805 16987-16987/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ Finalize session | |
| 09-04 13:39:15.548 16987-17002/com.zerodesktop.appdetox.dinnertimeplus I/art﹕ GcCauseBackground sticky partial concurrent mark sweep GC freed 28215(1976KB) AllocSpace objects, 10(285KB) LOS objects, 9% free, 21MB/23MB, paused 19.502ms total 85.914ms | |
| 09-04 13:39:15.638 16987-23777/com.zerodesktop.appdetox.dinnertimeplus W/FlurryAgent﹕ FlurryDataSender: report 175351dd-7b3b-46d4-bd3b-29e3a31f503b sent. HTTP response: 200 | |
| 09-04 13:39:15.779 16987-16987/com.zerodesktop.appdetox.dinnertimeplus E/AndroidRuntime﹕ FATAL EXCEPTION: main | |
| Process: com.zerodesktop.appdetox.dinnertimeplus, PID: 16987 | |
| java.lang.RuntimeException: Unable to start activity ComponentInfo{com.zerodesktop.appdetox.dinnertimeplus/com.zerodesktop.appdetox.dinnertime.control.ui.misc.DeviceNotificationAlertActivity}: java.lang.NullPointerException: Attempt to read from field 'long com.zerodesktop.appdetox.dinnertime.common.b.g.f' on a null object reference | |
| at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) | |
| at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) | |
| at android.app.ActivityThread.access$800(ActivityThread.java:135) | |
| at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) | |
| at android.os.Handler.dispatchMessage(Handler.java:102) | |
| at android.os.Looper.loop(Looper.java:136) | |
| at android.app.ActivityThread.main(ActivityThread.java:5001) | |
| at java.lang.reflect.Method.invoke(Native Method) | |
| at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) | |
| at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) | |
| Caused by: java.lang.NullPointerException: Attempt to read from field 'long com.zerodesktop.appdetox.dinnertime.common.b.g.f' on a null object reference | |
| at com.zerodesktop.appdetox.dinnertime.control.ui.a.d.a(Unknown Source) | |
| at com.zerodesktop.appdetox.dinnertime.control.ui.misc.DeviceNotificationAlertActivity.onCreate(Unknown Source) | |
| at android.app.Activity.performCreate(Activity.java:5231) | |
| at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) | |
| at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) | |
| at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) | |
| at android.app.ActivityThread.access$800(ActivityThread.java:135) | |
| at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) | |
| at android.os.Handler.dispatchMessage(Handler.java:102) | |
| at android.os.Looper.loop(Looper.java:136) | |
| at android.app.ActivityThread.main(ActivityThread.java:5001) | |
| at java.lang.reflect.Method.invoke(Native Method) | |
| at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) | |
| at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) | |
| 09-04 13:39:29.884 16987-16987/com.zerodesktop.appdetox.dinnertimeplus I/Process﹕ Sending signal. PID: 16987 SIG: 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment