本文介绍了Android的扩展应用基础知识的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在从应用程序扩展一个类设置全局变量。刚开混淆的基本知识。在以下code是工作,但它是做一个正确的方式?
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="";
}
时的onCreate()和构造都可以在那里?
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;
强麦删除C-器
这篇关于Android的扩展应用基础知识的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!