为什么在eclipse上的android中onStart()方法有一个罢工符号
下面是我得到的图片 这是一个eclipse问题吗为什么在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
当我们在
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命令。