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

时间:2014-07-07 16:35:39

标签: android eclipse

下面是我得到的图像

enter image description here

这是日食问题吗?

当我们在onStart()方法中放入任何代码时,它无法正常工作

1 个答案:

答案 0 :(得分:1)

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

请参阅此link

使用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;
}