Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
访问服务中的资源(Android)_Android_Resources_Intentservice - Fatal编程技术网

访问服务中的资源(Android)

访问服务中的资源(Android),android,resources,intentservice,Android,Resources,Intentservice,我是安卓系统的新开发者,所以我觉得我忽略了一些服务的属性。请让我知道 就服务而言,一切似乎都运转良好。我有一个IntentService类,如下所示: public class MyIntentService extends IntentService { myClass myObject; int test; public MyIntentService() { super("MyIntentService"); test = 12; myObject = ne

我是安卓系统的新开发者,所以我觉得我忽略了一些服务的属性。请让我知道

就服务而言,一切似乎都运转良好。我有一个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) {
}
公共类MyIntentService扩展了IntentService
{
myClass myObject;
智力测验;
公共MyIntentService()
{
超级(“MyIntentService”);
试验=12;
myObject=newmyclass(this,R.raw.file);
}
@凌驾
公共IBinder onBind(意向)
{
返回新的LocalBinder(此);
}
@凌驾
受保护的手部内容无效(意图){
}
myClass的构造函数接受一个上下文,然后接受一个原始资源的int。如果我在活动类中调用构造函数,它就可以正常工作。服务本身似乎也可以正常工作,因为如果我注释掉对象内容,我可以检索测试int,没有问题

那么我在这里错过了什么

多谢各位