每当我的应用程序启动时,我都必须从测试类中调用打印方法。我从MyApplication类的onCreate()调用了此打印方法,该方法扩展了android.app.application类。在print()方法中,我正在显示一条祝酒消息。但是,该吐司消息未显示。请帮助!
public class MyApplication extends Application
{
@Override
public void onCreate() {
super.onCreate();
Test.print(this);
Toast.makeText(this,"On Create called",Toast.LENGTH_LONG).show();
}
}
public class Test {
static void print(Context context)
{
Toast.makeText(context,"Print called",Toast.LENGTH_LONG).show();
}
}