Android Condition检查if else语句?

时间:2011-10-28 14:45:15

标签: android

我在这种情况下做的一些错误可以帮助我,我是技术新手吗?请问这类问题。

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:无法启动活动ComponentInfo {com.buddytv.android/com.buddytv.android.ui.MainViewActivity}:java。 lang.NullPointerException 10-28 20:26:47.244:ERROR / AndroidRuntime(305):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 10-28 20:26:47.244:ERROR / AndroidRuntime(305):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 10-28 20:26:47.244:ERROR / AndroidRuntime(305):在android.app.ActivityThread.access $ 2300(ActivityThread.java:125) 10-28 20:26:47.244:ERROR / AndroidRuntime(305):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2033) 10-28 20:26:47.244:ERROR / AndroidRuntime(305):在android.os.Handler.dispatchMessage(Handler.java:99) 10-28 20:26:47.244:ERROR / AndroidRuntime(305):在android.os.Looper.loop(Looper.java:123) 10-28 20:26:47.244:ERROR / AndroidRuntime(305):在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)

1 个答案:

答案 0 :(得分:0)

看起来你可能在错误的线程上这样做了。