if-else if statement not working properly in android -


my problem is, when use more 1 statement in if condtion (pro.getselecteditemposition()!=0 && allmemb.getselecteditemposition()!=0), checked if use single statement (pro.getselecteditemposition()!=0) , condition not checked.

string = null;      if(pro.getselecteditemposition()!=0 && allmemb.getselecteditemposition()!=0)     {          where="project='"+pro.getselecteditemposition()+"' , assigned_by='"+allmemb.getselecteditemposition()+"'";     }      else if(pro.getselecteditemposition()!=0 && allmod.getselecteditemposition()!=0)     {         where="project='"+pro.getselecteditemposition()+"' , module='"+allmod.getselecteditem()+"'";     }     else if(pro.getselecteditemposition()!=0 && allprio.getselecteditemposition()!=0)     {         where="project='"+pro.getselecteditemposition()+"' , priority='"+allprio.getselecteditem()+"'";     }      else if(pro.getselecteditemposition()!=0 && date.gettextsize()!=0)     {         where="project='"+pro.getselecteditemposition()+"' , t_date='"+date.gettext().tostring()+"'";     }     else if(allmemb.getselecteditemposition()!=0 && allmod.getselecteditemposition()!=0)     {         where="assigned_by='"+allmemb.getselecteditemposition()+"' , module='"+allmod.getselecteditem()+"'";     }     else if(allmemb.getselecteditemposition()!=0 && allprio.getselecteditemposition()!=0)     {         where="assigned_by='"+allmemb.getselecteditemposition()+"' , priority='"+allprio.getselecteditem()+"'";     }     else if(allmemb.getselecteditemposition()!=0 && date.gettextsize()!=0)     {         where="assigned_by='"+allmemb.getselecteditemposition()+"' , t_date='"+date.gettext().tostring()+"'";     }     else if(allmod.getselecteditemposition()!=0 && allprio.getselecteditemposition()!=0)     {         where="module='"+allmod.getselecteditem()+"' , priority='"+allprio.getselecteditem()+"'";     }     else if(allmod.getselecteditemposition()!=0 && date.gettextsize()!=0)     {         where="module='"+allmod.getselecteditem()+"' , t_date='"+date.gettext().tostring()+"'";     }     else if(allprio.getselecteditemposition()!=0 && date.gettextsize()!=0)     {         where="priority='"+allprio.getselecteditem()+"' , t_date='"+date.gettext().tostring()+"'";     }     else if(date.gettextsize()!=0 && date1.gettextsize()!=0)     {         where="t_date between '"+date.gettext().tostring()+"' , '"+date1.gettext().tostring()+"'";      }     else if(date.gettextsize()!=0)     {          where="t_date='"+date.gettext().tostring()+"'";     }     else if(pro.getselecteditemposition()==0 && allmemb.getselecteditemposition()==0 && allmod.getselecteditemposition()==0 &&              allprio.getselecteditemposition()==0 && date.gettextsize()==0 && date1.gettextsize()==0 )      {         //intent in=new intent(getapplicationcontext(),login.class);         //startactivity(in);         where="project='"+pro.getselecteditemposition()+"' , assigned_by='"+allmemb.getselecteditemposition()+"' , module='"+         allmod.getselecteditem()+"' , priority='"+allprio.getselecteditem()+"' ,  t_date='"+date.gettext().tostring()+"'";      }         else if(pro.getselecteditemposition()>0)     {         where="project='"+pro.getselecteditemposition()+"'";     }      else if(allmemb.getselecteditemposition()!=0)     {         where="assigned_by='"+allmemb.getselecteditemposition()+"'";     }     else if(allmod.getselecteditemposition()!=0)     {         where="module='"+allmod.getselecteditem()+"'";     }             else if(allprio.getselecteditemposition()!=0)     {         where="priority='"+allprio.getselecteditem()+"'";     }      else     {         //toast.maketext(admin.this, "no tasks displays.....  ", toast.length_short).show();     }      cursor cr6=sdb.query("task_details", new string[]{"userid","assigned_by","project","module","priority","t_date","t_desc","remarks"},                  where,null,null,null,null); 

if 1 of statements of && false wont check other condition because 1 false enough condition false.


Comments