访问服务中的资源(Android)

时间:2012-09-19 05:23:08

标签: android resources intentservice

我是一个相当新的Android开发人员,所以我觉得有一些我忽视的服务属性。请告诉我。

就服务而言,一切似乎都很好。我有一个如下所示的IntentService类:

public class MyIntentService extends IntentService 
{
myClass myObject;
int test;

public MyIntentService() 
{
    super("MyIntentService");

    test = 12;
    myObject = new myClass(this, R.raw.file);
}

@Override
public IBinder onBind(Intent intent)
{
    return new LocalBinder<MyIntentService>(this);
}

@Override
protected void onHandleIntent(Intent intent) {
}

myClass的构造函数接受Context,然后接受原始资源的int。如果我在Activity类中调用构造函数,它就可以正常工作。服务本身也似乎正在工作,因为如果我注释掉对象的东西,我可以检索测试int没问题。

那我在这里错过了什么?

非常感谢!

0 个答案:

没有答案