Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.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
为什么在eclipse上的android中onStart()方法有一个罢工符号_Android_Eclipse - Fatal编程技术网

为什么在eclipse上的android中onStart()方法有一个罢工符号

为什么在eclipse上的android中onStart()方法有一个罢工符号,android,eclipse,Android,Eclipse,下面是我得到的图片 这是一个eclipse问题吗 当我们在onStart()方法中放入任何代码时,它都不起作用这是因为onStart()已被弃用,您现在可以使用onStart命令() 看到这个了吗 使用onStartCommand()。 来自谷歌文档 // This is the old onStart method that will be called on the pre-2.0 // platform. @Override public void onStart(Intent in

下面是我得到的图片

这是一个eclipse问题吗


当我们在
onStart()
方法中放入任何代码时,它都不起作用

这是因为
onStart()
已被弃用,您现在可以使用
onStart命令()

看到这个了吗

使用
onStartCommand()
。 来自谷歌文档

// This is the old onStart method that will be called on the pre-2.0
// platform. 

@Override
public void onStart(Intent intent, int startId) {
    handleStart(intent, startId);
}

//On 2.0 or later we override onStartCommand() so this
// method will not be called.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    handleStart(intent, startId);
    return START_NOT_STICKY;
}

这意味着该函数已被弃用。它仍然可以工作,但是在大多数情况下应该使用onStart命令而不是onStart命令。