java - Null Pointer exception and intent error -


my app crash whenever click on button... button gets text edittext, , believe that why have null pointer exception. first question: how can check if edittext empty? tried .equals(""), .equals(null), same matches, , .lenght == 0 second, when try call intent listactivity class handling error. (activity not found. no activity handle.) ill give onclicklistener

on click listener

button.setonclicklistener(new onclicklistener() {             @override             public void onclick(view arg0) {                  searchinenglish = rsearchenglish.ischecked();                 searchindovahzul = rsearchdovahzul.ischecked();                  searchbox = (edittext) findviewbyid(r.id.tvsearch);                  if (searchbox.gettext().tostring().equals("")){                      if (searchinenglish) {                         int counter = 0;                         (int = 0; < englisharray.length; i++) {                             if (englisharray[i].contains(searchbox.gettext())) {                                 counter++;                                 intent search = new intent(                                         "net.fernandezgodinho.pedro.dovahzuldictionary.searchlist");                                 startactivity(search);                             }                         }                         setfinalsearch(searchresultsenglish);                     }                      if (searchindovahzul = true) {                         int counter = 0;                         (int = 0; < dovahzularray.length; i++) {                             if (dovahzularray[i].contains(searchbox.gettext())) {                                 counter++;                                 intent search = new intent(                                         "net.fernandezgodinho.pedro.dovahzuldictionary.searchlist");                                 startactivity(search);                             }                         }                     }                 } else {                     toast.maketext(mainactivity.this, "please use @ least 2 characters", toast.length_long).show();                 }             }         }); 

it seems calling activity application.

have added <intent-filter> activity in application manifest ?

step #1: add <intent-filter> second activity custom action:

<intent-filter>   <action android:name="com.testapp.ws.xyz"/>   <category android:name="android.intent.category.default" /> </intent-filter> 

step #2: start activity using appropriate intent:

startactivity(new intent("com.testapp.ws.xyz")); 

see further explanations - https://stackoverflow.com/a/10961409/826657


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -