java - Syntax Error: Constructor call must be the first statement in a constructor -


i creating navigations app application settings.
creating following code, but, mention above in title, getting syntax error.
kindly guide me through problem.

here mainactivity.java

import android.net.uri; import android.os.bundle; import android.app.activity; import android.content.activitynotfoundexception; import android.content.intent; import android.content.pm.packagemanager; import android.view.menu; import android.view.view;  public class mainactivity extends activity {      public mainactivity() {      }      private boolean mystartactivity(intent intent) {         try {             startactivity(intent);         } catch (activitynotfoundexception activitynotfoundexception) {             return false;         }          return true;     }      protected boolean isappinstalled(string s) {         packagemanager packagemanager = getpackagemanager();          try {             packagemanager.getpackageinfo(s, 128);         } catch (android.content.pm.packagemanager.namenotfoundexception namenotfoundexception) {             return false;         }          return true;     }      protected void oncreate(bundle bundle) {         super.oncreate(bundle);         setcontentview(0x7f030000);          if (getintent().getintextra("reload", 0) == 1) {             if (isappinstalled("com.sample.test")) {                 intent intent = new intent("android.settings.application_details_settings");                 intent.addcategory("android.intent.category.default");                 intent.setdata(uri.parse("package:com.sample.test"));                 startactivity(intent);             } else {                 toast.maketext(getapplicationcontext(), "game not instaled", 0).show();             }         }          ((button)findviewbyid(0x7f080000)).setonclicklistener(new android.view.view.onclicklistener() {             final mainactivity this$0;              public void onclick(view view) {                 if (isappinstalled("com.sample.test")) {                     intent intent1 = new intent("android.settings.application_details_settings");                     intent1.addcategory("android.intent.category.default");                     intent1.setdata(uri.parse("package:com.sample.test"));                     startactivity(intent1);                      return;                 } else {                     toast.maketext(getapplicationcontext(), "game not instaled", 0).show();                      return;                 }             }              {                 this$0 = mainactivity.this;                 super(); //constructor call must first statement in constructor             }         });     }  } 

you created anonymous inner class:

new android.view.view.onclicklistener() {     // code exists here      super(); } 

and @ bottom of class call super(); super constructor call. call must first one, in case totally unnecessary. remove it.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -