黑马程序员技术交流社区
标题:
求解
[打印本页]
作者:
(^_^)
时间:
2013-9-14 00:27
标题:
求解
private void loadMainUI() {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
//执行此处出错
finish(); // 把当前activity从任务栈里面移除
;
}
package cn.itcast.mobilesafe.ui;
import cn.itcast.mobilesafe.R;
import cn.itcast.mobilesafe.adapter.MainUIAdapter;
import android.app.Activity;
import android.os.Bundle;
import android.widget.GridView;
public class MainActivity extends Activity {
private GridView gv_main;
private MainUIAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainscreen);
gv_main=(GridView) this.findViewById(R.id.gv_main);
adapter=new MainUIAdapter(this);
gv_main.setAdapter(adapter);
}
}
09-13 16:20:02.705: E/AndroidRuntime(2930): FATAL EXCEPTION: main
09-13 16:20:02.705: E/AndroidRuntime(2930): java.lang.NullPointerException
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.widget.GridView.onMeasure(GridView.java:934)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.view.View.measure(View.java:8171)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.view.View.measure(View.java:8171)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.view.View.measure(View.java:8171)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.view.View.measure(View.java:8171)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.view.View.measure(View.java:8171)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.os.Handler.dispatchMessage(Handler.java:99)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.os.Looper.loop(Looper.java:123)
09-13 16:20:02.705: E/AndroidRuntime(2930): at android.app.ActivityThread.main(ActivityThread.java:4627)
09-13 16:20:02.705: E/AndroidRuntime(2930): at java.lang.reflect.Method.invokeNative(Native Method)
09-13 16:20:02.705: E/AndroidRuntime(2930): at java.lang.reflect.Method.invoke(Method.java:521)
09-13 16:20:02.705: E/AndroidRuntime(2930): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-13 16:20:02.705: E/AndroidRuntime(2930): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-13 16:20:02.705: E/AndroidRuntime(2930): at dalvik.system.NativeStart.main(Native Method)
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2