soufiane.dev Posted May 17, 2011 Share Posted May 17, 2011 Salut, c'est mon premier post :) je veux faire une button qui affiche une listeview et dans la list il y a un textEdit pour la recherche dans la liste (filtrage) mais ce code montre l'erreur d'impossible démarrer l'activity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.index); this.findViewById(R.id.btngetshedule).setOnClickListener( new Button.OnClickListener() { @Override public void onClick(View v) { setContentView(R.layout.main); vaccinList(); } }); Cursor c2 = db.vaccinchild(); startManagingCursor(c2); final SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.vaccinlist, c2, new String[] { DBAdapter.doctor, DBAdapter.child_name, DBAdapter.date_received }, new int[] { R.id.txtvaccin, R.id.txtchild, R.id.txtdate }); setListAdapter(adapter); EditText txtFilter = (EditText) findViewById(R.id.txtsearch); txtFilter.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { adapter.getFilter().filter(s); } public void beforeTextChanged(CharSequence s, int start, int count, int after) {adapter.getFilter().filter(s); } public void onTextChanged(CharSequence s, int start, int before, int count) { adapter.getFilter().filter(s); } }); } Link to comment Share on other sites More sharing options...
pat Posted May 17, 2011 Share Posted May 17, 2011 quelle est l'erreur exactement? Link to comment Share on other sites More sharing options...
soufiane.dev Posted May 17, 2011 Author Share Posted May 17, 2011 l'erreur c'est Unable to start activity est montré sur l’événement addTextChangedListener Link to comment Share on other sites More sharing options...
pat Posted May 17, 2011 Share Posted May 17, 2011 essaye de voir tout le log dans logcat, tu sauras exactement quel est ton pb avec la stacktrace Link to comment Share on other sites More sharing options...
soufiane.dev Posted May 17, 2011 Author Share Posted May 17, 2011 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): FATAL EXCEPTION: main 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Webdirect.VaccinManager/com.Webdirect.VaccinManager.Main}: java.lang.NullPointerException 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at android.app.ActivityThread.access$1500(ActivityThread.java:123) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at android.os.Handler.dispatchMessage(Handler.java:99) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at android.os.Looper.loop(Looper.java:126) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at android.app.ActivityThread.main(ActivityThread.java:3997) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at java.lang.reflect.Method.invokeNative(Native Method) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at java.lang.reflect.Method.invoke(Method.java:491) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at dalvik.system.NativeStart.main(Native Method) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): Caused by: java.lang.NullPointerException 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at com.Webdirect.VaccinManager.Main.onCreate(Main.java:40) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700) 05-17 21:49:03.566: ERROR/AndroidRuntime(13637): ... 11 more 05-17 21:49:03.616: WARN/ActivityManager(60): Force finishing activity com.Webdirect.VaccinManager/.Main 05-17 21:49:04.166: WARN/ActivityManager(60): Activity pause timeout for ActivityRecord{40873e38 com.Webdirect.VaccinManager/.Main} 05-17 21:49:06.075: DEBUG/dalvikvm(60): GC_CONCURRENT freed 606K, 18% free 9638K/11655K, paused 15ms+89ms 05-17 21:49:13.005: WARN/ProcessStats(60): Skipping unknown process pid 13660 05-17 21:49:13.045: WARN/ProcessStats(60): Skipping unknown process pid 13661 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.