Android Condition checking if else statements?
some mistake i did in this condition can an help me,i am new to technology?sry to ask this type of questions.
if (((getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_LARGE) ==
Configuration.SCREENLAYOUT_SIZE_LARGE)&& config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
final LinearLayout gridViews = (LinearLayout) findViewById(R.id.grid_id);
OnNowGridView view = new OnNowGridView(this);
gridViews.addView(view);
}
- 10-28 20:26:47.244: ERROR/AndroidRuntime(305): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.buddytv.android/com.buddytv.android.ui.MainViewActivity}: java.lang.NullPointerException 10-28 20:26:47.244: ERROR/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 10-28 20:26:47.244: ERROR/AndroidRuntime(305): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 10-28 20:26:47.244: ERROR/AndroidRuntime(305): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 10-28 20:26:47.244: ERROR/AndroidRuntime(305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 10-28 20:26:47.244: ERROR/AndroidRuntime(305): at android.os.Handler.dispatchMessage(Handler.java:99) 10-28 20:26:47.244: ERROR/AndroidRuntime(305): at android.os.Looper.loop(Looper.java:123) 10-28 20:26:47.244: ERROR/AndroidRuntime(305): at android.app.ActivityThread.main(ActivityThread.java:4627) 10-28 20:26 :47.244: ERROR/AndroidRuntime(305): at java.lang.reflect.Method.invokeNative(Native Method) 10-28 20:26:47.244: ERROR/AndroidRuntime(305): at java.lang.reflect.Method.invoke(Method.java:521) 10-28 20:26:47.244: ERROR/AndroidRuntime(305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 10-28 20:26:47.244: ERROR/AndroidRuntime(305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
看起来你可能会在错误的线程上做这件事。
链接地址: http://www.djcxy.com/p/31426.html上一篇: 使用数组的NullPointerException
下一篇: Android条件检查是否其他语句?