如何从活动的包含类中启动意图
|
我正在寻找一种最佳方法,该方法是从不是Activity而是Activity类的一个包含对象的类中启动意图的。
例如活动类:
Class MainActivity extends ListActivty
{
...
TestLauncher tester;
}
我想从中开始意图的课程:
Class TestLauncher
{
public TestLauncher ()
{
//Code to create an intent needs a Context
//Intent i = new Intent(Context, class)
//Code to start activity needs to be called with an Activity
//Activity.StartActivity(i);
}
}
在架构上做到这一点的最佳方法是什么?我应该将MainActivity
作为参数传递给TestLauncher
\的构造函数吗?还是有我不知道的更好的方法?
没有找到相关结果
已邀请:
1 个回复
结乳