每当我的应用程序启动时,我都必须从测试类调用打印方法。我从 MyApplication 类的 onCreate() 调用了这个打印方法,它扩展了 android.app.application 类。在 print() 方法中,我显示一条 toast 消息。但是,该 toast 消息没有显示。请帮忙!
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();
}
}
慕容708150
相关分类