在搜索了stackoverflow以查看是否有问题之后,没有人对此有所帮助。
在我的主要活动中,我有这个:
if (GlobalVars.espera == 0)
{
GlobalVars.espera = 1;
try
{
bgIntent = new Intent(this, Loadscreen.class);
startService(bgIntent);
}
catch (Exception e)
{
GlobalFunctions.toast_message(context, "nao");
}
}
当我启动应用程序时,它应该加载打算在后台工作,但事实并非如此。
以下是加载屏幕类:
public class Loadscreen extends IntentService{
MainActivity teste;
private static final String intService = "loadscreen";
public Loadscreen()
{
super(intService);
// TODO Auto-generated constructor stub
}
@Override
protected void onHandleIntent(Intent intent)
{
teste = new MainActivity ();
try
{
teste.inic();
}
catch (Exception e)
{
}
}
}
和清单我已经把
<service android:name=".Loadscreen"></service>
也作为申请的孩子
即使我有尝试,它也没有进入捕捉AKA错误,但仍然没有进入类Loadscreen。
感谢您的帮助和时间
答案 0 :(得分:0)
你有
teste = new MainActivity (); // assuming MainActivity is a Activity class
您正在实例化错误的Activity类。