user1143989 user1143989 - 8 months ago 65
Android Question

Android extends Application basics

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 ()
new UncaughtExceptionHandler(){
public void uncaughtException(Thread arg0, Throwable arg1) {
Functions.CustomToastLong(getApplicationContext(), arg0.toString() + arg1.toString());

public GlobalMV(){
userid ="000000";

Is onCreate() and constructor both can be there ?


looks fine, you can also write:

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

ale remove c-tor