Syntax error, insert ";" to complete BlockStatements GreenDroid

22,261

Cut some of that nesting up into multiple lines. That way you can get better visibility as to the location the compiler is complaining about. For example

1 @Override
2 public Intent getMainApplicationIntent() {
3     return new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.app_url)));
4 }

might tell you a semicolon is needed at line 3, but

1  @Override
2  public Intent getMainApplicationIntent() {
3      return new Intent(
4          Intent.ACTION_VIEW, 
5          Uri.parse(
6              getString(
7                  R.string.app_url
8              )
9          )
10     );
11 }

might tell you a semicolon is needed at line 8.

After you have identified where the semicolon is needed, you can happily put the line back together, with a semicolon in the "right" spot.

Share:
22,261
TheCad
Author by

TheCad

Updated on August 28, 2020

Comments

  • TheCad
    TheCad over 3 years

    When I try to make a make an Android app with GreenDroid, so I put the code in there but it asks for a ; while there already is one.

    as people asked for the whole code hereby the whole code!

    import greendroid.app.GDApplication;
    import android.content.Intent;
    import android.net.Uri;
    
    public class GreenDroidTest extends GDApplication {
    
    @Override
    public Class<?> getHomeActivityClass() {
        return GreenDroidTest.class;
    }
    
    @Override
    public Intent getMainApplicationIntent() {
    return new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.app_url)));
        }
    
     }
    

    And I can't find any solutions. I already tried Cleaning and building the workspace.

  • s_bei
    s_bei over 11 years
    I am able to copy the code above without compilererrors. I dont think that method is the reason for the message...
  • Edwin Buck
    Edwin Buck over 11 years
    then look to the code outside of the method, perhaps this is overriding an anonymous object (an object that has no sub-type, but directly overrides abstracts), and the outside constructor block lacks a required terminating semicolon. In any event, keep a close eye on line numbers, and expand if necessary should the line have too many options for semicolon placement.
  • Mohit
    Mohit over 11 years
    @BC_ Is it possible to use getString(); without Extending Activity Class?
  • TheCad
    TheCad over 11 years
    @EdwinBuck Thank you for that sollution,i trieded it and while trying it solved it self so i don't know why it did that but still, Thank you