0

I am setting global variables in a class which extends from Application. Just getting confused with the basics. The the following code is working but is it a right way to do it ?

public class GlobalMV extends Application{

private static final String TAG = "Global";
private String userid, pwd, name, station;

@Override public void onCreate () 
{     
    Thread.setDefaultUncaughtExceptionHandler(            
            new UncaughtExceptionHandler(){                  
                @Override                 
                public void uncaughtException(Thread arg0, Throwable arg1) {                     
                       Functions.CustomToastLong(getApplicationContext(), arg0.toString() + arg1.toString());
            }              
        }     
    );     
    super.onCreate();   
} 

public GlobalMV(){
   userid ="000000";
   pwd="";
}

Is onCreate() and constructor both can be there ?

user1143989
  • 163
  • 1
  • 3
  • 18

1 Answers1

0

looks fine, you can also write:

private String userid="000000";
private String pwd;
private String name;
private String station;

ale remove c-tor

marcinj
  • 48,511
  • 9
  • 79
  • 100