Java IF ELSE syntax error -


i'm having java syntax error on if else statement. reviewed code several times couldn't figure out what's wrong. error : syntax error on token "else", delete token. doing wrong here?

if(androidfragment!=null)     ft.detach(androidfragment);  if(applefragment!=null)     ft.detach(applefragment);  if(berryfragment!=null)     ft.detach(berryfragment);   if(tabid.equalsignorecase("android")){      if(androidfragment==null){                ft.add(r.id.realtabcontent,new androidfragment(), "android");                            }else{          ft.attach(androidfragment);                          }  }else if{         if(applefragment==null){          ft.add(r.id.realtabcontent,new applefragment(), "apple");                            }else{          ft.attach(applefragment);                    }  }else{        if(berryfragment==null){          ft.add(r.id.realtabcontent,new berryfragment(), "berry");                            }else{          ft.attach(berryfragment);                            }  } 

you can have 1 else attached if; here have 2 elses, applefragment , berryfragment.

if(tabid.equalsignorecase("android")){    ... }else{        ...  }else{        ...  } 

edit

you have following code fragment:

} else if { 

your else if requires condition, e.g.

} else if (/*another boolean condition here applefragment*/) { 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -