public class MainActivity extends FragmentActivity implements DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener,AdapterView.OnItemSelectedListener{

public static final String DATEPICKER_TAG = "datepicker";

public static final String TIMEPICKER_TAG = "timepicker";

private TextView t;

private TextView t2;

private Context cn=this;

private static String[]ModeItems=new String[]{"1","2","3","4"};

@Override

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ArrayAdapter <String> adapter=new ArrayAdapter<String>(this,R.layout.text,ModeItems);
    final Spinner Secici=(Spinner)findViewById(R.id.secici);

    Secici.setOnItemSelectedListener(this);
    Secici.setAdapter(adapter);

UYgulama açılmıyor neden olabilir

logcat: 07-31 18:42:08.797 4220-4220/com.asg.talentedalarmpro E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.asg.talentedalarmpro, PID: 4220 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.asg.talentedalarmpro/com.asg.talentedalarmpro.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Spinner.setOnItemSelectedListener(android.widget.AdapterView$OnItemSelectedListener)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2367) at android.app.ActivityThread.access$800(ActivityThread.java:148) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5274) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Spinner.setOnItemSelectedListener(android.widget.AdapterView$OnItemSelectedListener)' on a null object reference at com.asg.talentedalarmpro.MainActivity.onCreate(MainActivity.java:47) at android.app.Activity.performCreate(Activity.java:5977) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2258)             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2367)             at android.app.ActivityThread.access$800(ActivityThread.java:148)             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)             at android.os.Handler.dispatchMessage(Handler.java:102)             at android.os.Looper.loop(Looper.java:135)             at android.app.ActivityThread.main(ActivityThread.java:5274)             at java.lang.reflect.Method.invoke(Native Method)             at java.lang.reflect.Method.invoke(Method.java:372)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)

soruldu: 30 Tem '15, 12:17

however's gravatar image

however
105131923
cevap kabul oranı: 0%

değiştirildi: 31 Tem '15, 11:58

1

Koddan ziyade Logcat'deki hatayı yazarsanız daha kolay yardım edebiliriz.

(31 Tem '15, 07:55) ersinyildiz ersinyildiz's gravatar image

Öncelikle Teşekkür ederim.Yorum kısmına sığmadığı için Soruya logcat çıktısını ekledim işaretlenmiş yerleri...

(31 Tem '15, 11:59) however however's gravatar image
Bu soruya ilk cevap veren sen ol!
toggle preview

Bu soruyu takip et

E-Posta üzerinden:

Üyelik girişi yaptıktan sonra abonelik işlemlerini yapabilirsiniz

RSS üzerinden:

Cevaplar

Cevaplar ve Yorumlar

Yazı Formatlama

  • *italic* ya da _italic_
  • **bold** ya da __bold__
  • link:[text](http://url.com/ "başlık")
  • resim?![alt text](/path/img.jpg "başlık")
  • liste: 1. Foo 2. Bar
  • temel HTML etiketleri de kullanılabilir

Bu sorunun etiketleri:

×1,079
×819
×14
×4

Soruldu: 30 Tem '15, 12:17

Görüntüleme: 212 kez

Son güncelleme: 31 Tem '15, 11:59

powered by BitNami OSQA