Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.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_Android Layout_Android Intent_Android Service - Fatal编程技术网

Android 为什么我的应用程序会崩溃?我正在使用服务

Android 为什么我的应用程序会崩溃?我正在使用服务,android,android-layout,android-intent,android-service,Android,Android Layout,Android Intent,Android Service,我做了一个服务,他每5秒钟在屏幕上贴一个标签(我想这就是这个的名字)。当我启动时,它需要把标签放在屏幕上,但他说应用程序崩溃了。为什么? 守则: Android清单: <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <receiver android:name="com.YuvalFatal.MyBroadcastReceiver" >

我做了一个服务,他每5秒钟在屏幕上贴一个标签(我想这就是这个的名字)。当我启动时,它需要把标签放在屏幕上,但他说应用程序崩溃了。为什么? 守则: Android清单:

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <receiver android:name="com.YuvalFatal.MyBroadcastReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>
    <service android:enabled="true" android:name="com.YuvalFatal.MyService"/>
意向服务:

package com.YuvalFatal.ineedhelp;

import android.app.IntentService;
import android.content.Intent;
import android.util.Log;


public class MyService extends IntentService {

private static final String TAG = "com.YuvalFatal.ineedhelp";

public MyService(String name) {
    super(name);
    // TODO Auto-generated constructor stub
}

@Override
protected void onHandleIntent(Intent intent) {
    // TODO Auto-generated method stub
    Log.i(TAG, "Intent Service started");
}

}
我认为(是的,我是魔术师,有很强的直觉:)您的服务构造函数应该是默认的:

public class MyService extends IntentService {
    ...

    public MyService() { // Default constructor! Without params!
        super("MyService"); // Or another string
    }

...
}
其他代码看起来很正常

我认为(是的,我是魔术师,直觉很好:)您的服务构造函数应该是默认的:

public class MyService extends IntentService {
    ...

    public MyService() { // Default constructor! Without params!
        super("MyService"); // Or another string
    }

...
}

其他代码看起来正常

你能在这里发布应用程序崩溃的日志吗?你能在这里发布应用程序崩溃的日志吗。