uygulamaya metot yazınca hata alıyor
merhabalar
uygulamaya metot yazıyorum test ederken uygulama durduruldu uyarısı alıyorum
yazdığım metotda değer döndüremyen parametresiz bir metot sadece ekrana yazı yazdırıcam bi komut.
logcat de verdiği uyarı mesajları :
03-07 15:40:00.904 4731-4731/? D/dalvikvm: Late-enabling CheckJNI
03-07 15:40:00.916 4731-4731/com.example.ulasyilmaz.metod D/AndroidRuntime: Shutting down VM
03-07 15:40:00.916 4731-4731/com.example.ulasyilmaz.metod W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa61e8908)
03-07 15:40:00.916 4731-4731/com.example.ulasyilmaz.metod E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.ulasyilmaz.metod/com.example.ulasyilmaz.metod.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.app.Activity.findViewById(Activity.java:1839)
at com.example.ulasyilmaz.metod.MainActivity.<init>(MainActivity.java:9)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
03-07 15:40:04.640 4731-4731/? I/Process: Sending signal. PID: 4731 SIG: 9
Buda yazdığım kod :