80,351
社区成员
发帖
与我相关
我的任务
分享
package com.example.testproject;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn = (Button) findViewById(R.id.btn);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(MainActivity.this, Activity1.class);
startActivity(intent);
}
});
}
}
package com.example.testproject;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class Activity1 extends Activity {
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn = (Button) findViewById(R.id.btn);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(Activity1.this, Activity2.class);
startActivity(intent);
}
});
}
}
package com.example.testproject;
import android.app.Activity;
import android.os.Bundle;
public class Activity2 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
throw new NullPointerException();
}
}
02-16 21:09:18.972: E/AndroidRuntime(15496): FATAL EXCEPTION: main
02-16 21:09:18.972: E/AndroidRuntime(15496): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testproject/com.example.testproject.Activity2}: java.lang.NullPointerException
02-16 21:09:18.972: E/AndroidRuntime(15496): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2372)
02-16 21:09:18.972: E/AndroidRuntime(15496): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2424)
02-16 21:09:18.972: E/AndroidRuntime(15496): at android.app.ActivityThread.access$600(ActivityThread.java:169)
02-16 21:09:18.972: E/AndroidRuntime(15496): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1388)
02-16 21:09:18.972: E/AndroidRuntime(15496): at android.os.Handler.dispatchMessage(Handler.java:107)
02-16 21:09:18.972: E/AndroidRuntime(15496): at android.os.Looper.loop(Looper.java:194)
02-16 21:09:18.972: E/AndroidRuntime(15496): at android.app.ActivityThread.main(ActivityThread.java:5433)
02-16 21:09:18.972: E/AndroidRuntime(15496): at java.lang.reflect.Method.invokeNative(Native Method)
02-16 21:09:18.972: E/AndroidRuntime(15496): at java.lang.reflect.Method.invoke(Method.java:525)
02-16 21:09:18.972: E/AndroidRuntime(15496): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:922)
02-16 21:09:18.972: E/AndroidRuntime(15496): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:689)
02-16 21:09:18.972: E/AndroidRuntime(15496): at dalvik.system.NativeStart.main(Native Method)
02-16 21:09:18.972: E/AndroidRuntime(15496): Caused by: java.lang.NullPointerException
02-16 21:09:18.972: E/AndroidRuntime(15496): at com.example.testproject.Activity2.onCreate(Activity2.java:11)
02-16 21:09:18.972: E/AndroidRuntime(15496): at android.app.Activity.performCreate(Activity.java:5211)
02-16 21:09:18.972: E/AndroidRuntime(15496): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
02-16 21:09:18.972: E/AndroidRuntime(15496): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2336)
02-16 21:09:18.972: E/AndroidRuntime(15496): ... 11 more
02-16 21:09:20.265: I/Process(15496): Sending signal. PID: 15496 SIG: 9
02-16 21:09:20.355: D/jdwp(15577): sendBufferedRequest : len=0x49
02-16 21:09:20.358: W/asset(15577): AssetManager-->addDefaultAssets CIP path not exsit!
02-16 21:09:20.363: D/dalvikvm(15577): open_cached_dex_file : /data/app/com.example.testproject-2.apk /data/dalvik-cache/data@app@com.example.testproject-2.apk@classes.dex
02-16 21:09:20.451: D/libEGL(15577): >>> 0 0 android
02-16 21:09:20.451: D/libEGL(15577): >>> 0 1 mali
02-16 21:09:20.453: D/libEGL(15577): loaded /system/lib/egl/libEGL_mali.so
02-16 21:09:20.454: D/libEGL(15577): loaded /system/lib/egl/libGLESv1_CM_mali.so
02-16 21:09:20.457: D/libEGL(15577): loaded /system/lib/egl/libGLESv2_mali.so
02-16 21:09:20.461: E/linker(15577): load_library(linker.cpp:759): library "libmaliinstr.so" not found
02-16 21:09:20.462: E/(15577): appName=com.example.testproject, acAppName=com.android.cts.openglperf
02-16 21:09:20.462: E/(15577): 0
02-16 21:09:20.462: E/(15577): appName=com.example.testproject, acAppName=com.android.browser
02-16 21:09:20.462: E/(15577): 0
02-16 21:09:20.467: D/GraphicBuffer(15577): create handle(0x5c2ec968) (w:720, h:1280, f:1)
02-16 21:09:20.471: D/GraphicBuffer(15577): close handle(0x5c2ec968) (w:720 h:1280 f:1)
02-16 21:09:20.475: D/GraphicBuffer(15577): create handle(0x5c2ec968) (w:720, h:1280, f:1)
02-16 21:09:20.478: D/OpenGLRenderer(15577): Enabling debug mode 0
02-16 21:09:20.481: I/View(15577): Touch down dispatch to android.widget.RelativeLayout{417b4840 V.E..... ......ID 0,0-720,1134}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=327.0, y[0]=579.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x1, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=291158790, downTime=291158790, deviceId=2, source=0x1002 }
02-16 21:09:20.481: I/View(15577): Touch down dispatch to android.widget.FrameLayout{417af860 V.ED.... ......ID 0,146-720,1280 #1020002 android:id/content}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=327.0, y[0]=579.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x1, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=291158790, downTime=291158790, deviceId=2, source=0x1002 }
02-16 21:09:20.482: I/View(15577): Touch down dispatch to android.widget.LinearLayout{4177d5d0 V.E..... ......ID 0,0-720,1280}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=327.0, y[0]=725.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x1, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=291158790, downTime=291158790, deviceId=2, source=0x1002 }
02-16 21:09:20.482: I/View(15577): Touch down dispatch to com.android.internal.policy.impl.PhoneWindow$DecorView{4177c6f0 V.E..... R.....ID 0,0-720,1280}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=327.0, y[0]=725.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x1, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=291158790, downTime=291158790, deviceId=2, source=0x1002 }
02-16 21:09:20.483: I/View(15577): Touch up dispatch to com.android.internal.policy.impl.PhoneWindow$DecorView{4177c6f0 V.E..... R.....ID 0,0-720,1280}, event = MotionEvent { action=ACTION_UP, id[0]=0, x[0]=325.0, y[0]=723.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x1, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=291158862, downTime=291158790, deviceId=2, source=0x1002 }
02-16 21:09:20.489: V/InputMethodManager(15577): onWindowFocus: null softInputMode=288 first=true flags=#1810100
02-16 21:09:20.489: V/InputMethodManager(15577): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView{4177c6f0 V.E..... R.....ID 0,0-720,1280} ic=null tba=android.view.inputmethod.EditorInfo@417c6468 controlFlags=#104
02-16 21:09:20.491: V/InputMethodManager(15577): Starting input: Bind result=InputBindResult{null com.baidu.input_huawei/.ImeService #14090}
02-16 21:09:21.608: V/Activity(15577): Tracking Key Up, activity is resumed: false
02-16 21:09:21.632: D/GraphicBuffer(15577): create handle(0x5e1937f0) (w:720, h:1280, f:1)
02-16 21:09:21.641: I/SurfaceTextureClient(15577): [STC::queueBuffer] (this:0x5a77d748) fps:0.91, dur:1101.37, max:1101.37, min:1101.37
02-16 21:09:21.792: D/OpenGLRenderer(15577): Flushing caches (mode 0)
02-16 21:09:21.797: D/GraphicBuffer(15577): create handle(0x5e1a4f80) (w:720, h:1280, f:1)
02-16 21:09:21.802: D/GraphicBuffer(15577): close handle(0x5c2ec968) (w:720 h:1280 f:1)
02-16 21:09:21.803: D/GraphicBuffer(15577): close handle(0x5e1937f0) (w:720 h:1280 f:1)
02-16 21:09:21.803: D/GraphicBuffer(15577): close handle(0x5e1a4f80) (w:720 h:1280 f:1)
02-16 21:09:21.996: D/OpenGLRenderer(15577): Flushing caches (mode 1)
02-16 21:09:21.998: D/OpenGLRenderer(15577): Flushing caches (mode 0)